0 Replies Latest reply on Jun 20, 2007 7:21 AM by aidan davis

    Seam 1.3 Alpha and Basic Authentication

    aidan davis Newbie

      Hello,

      I'm relatively new to Seam and am trying to want to integrate an application using seam into an existing ear. The other apps in the ear use basic authentication therefore I have been trying to use the AuthenticationFilter in Seam 1.3 Alpha.

      My components.xml:

      <components xmlns="http://jboss.com/products/seam/components"
       xmlns:core="http://jboss.com/products/seam/core"
       xmlns:web="http://jboss.com/products/seam/web"
       xmlns:security="http://jboss.com/products/seam/security"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation=
       "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.3.xsd
       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.3.xsd
       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-1.3.xsd
       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.3.xsd
       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.3.xsd">
      
       <core:init jndi-pattern="SMSPortal/#{ejbName}/local" debug="true"/>
      
       <!--<core:jbpm>
       <core:process-definitions>
       <value>business-process.jpdl.xml</value>
       </core:process-definitions>
       </core:jbpm>-->
      
       <core:manager conversation-timeout="120000" />
      
       <core:managed-persistence-context name="entityManager"
       auto-create="true"
       persistence-unit-jndi-name="java:/crsEntityManagerFactory"/>
      
       <core:ejb installed="false"/>
      
       <web:authentication-filter url-pattern="*.seam" auth-type="basic" realm="SMSLDAP"/>-->
      
      
       <security:identity authenticate-method="#{login:login}" jaas-config-name="SMSLDAP"/>
      
      
      </components>


      And the exceptions I'm getting:

      11:10:24,088 INFO [Initialization] done initializing Seam
      11:10:24,088 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.redirectFilter
      11:10:24,088 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.multipartFilter
      11:10:24,088 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.exceptionFilter
      11:10:24,088 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.authenticationFilter
      11:10:24,182 INFO [EARDeployer] Started J2EE application: file:/C:/Software/jboss-4.2.0.GA/server/default/deploy/SMSPortal.ear/
      11:10:24,681 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
      11:10:24,728 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
      11:10:25,009 INFO [Server] JBoss (MX MicroKernel) [4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)] Started in 1m:570ms
      11:10:41,973 ERROR [ExceptionFilter] uncaught exception
      java.lang.NullPointerException
       at org.jboss.seam.web.AuthenticationFilter.processBasicAuth(AuthenticationFilter.java:154)
       at org.jboss.seam.web.AuthenticationFilter.doFilter(AuthenticationFilter.java:121)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:127)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      11:10:42,114 ERROR [ExceptionFilter] exception root cause
      11:10:42,160 INFO [Lifecycle] starting up: org.jboss.seam.core.servletSession
      11:10:42,176 INFO [Lifecycle] starting up: org.jboss.seam.security.identity
      11:10:43,159 ERROR [DebugPageHandler] redirecting to debug page
      java.lang.NullPointerException
       at org.jboss.seam.web.AuthenticationFilter.processBasicAuth(AuthenticationFilter.java:154)
       at org.jboss.seam.web.AuthenticationFilter.doFilter(AuthenticationFilter.java:121)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:127)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      11:10:43,284 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      java.lang.IllegalArgumentException: Stack must not be null
       at org.jboss.seam.core.ConversationEntry.<init>(ConversationEntry.java:40)
       at org.jboss.seam.core.ConversationEntries.createConversationEntry(ConversationEntries.java:52)
       at org.jboss.seam.core.Manager.createConversationEntry(Manager.java:685)
       at org.jboss.seam.core.Manager.beforeRedirect(Manager.java:834)
       at org.jboss.seam.core.Manager.beforeRedirect(Manager.java:852)
       at org.jboss.seam.exceptions.DebugPageHandler.handle(DebugPageHandler.java:24)
       at org.jboss.seam.core.Exceptions.handle(Exceptions.java:78)
       at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:85)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:66)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:127)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)


      From my rudimentary knowledge of Seam, it looks like the NullPointer is caused by the Authentication filter being hit before the Identity object has been initialised and added to the application context.

      I really need to solve this problem, I have tried writing my own filter but have the same problem, how do I get the identity component to be initialised before my filter or the AuthenticationFilter?

      Thanks.