1 2 Previous Next 16 Replies Latest reply on Mar 16, 2012 8:23 AM by johnburgess

    NullPointerException @ DatabaseServerLoginModule.java:141, J

      Hello, all.

      I'm having some problems with the DatabaseServerLoginModule and would appreciate any help, as the logged error messages do not tell me much:

      DataSource

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE datasources
       PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
       "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
      <datasources>
       <local-tx-datasource>
       <jndi-name>FluxMonClockerDS</jndi-name>
      <!-- <use-java-context>false</use-java-context>-->
       <connection-url>
       jdbc:postgresql://localhost:5432/fluxmon
       </connection-url>
       <driver-class>org.postgresql.Driver</driver-class>
       <user-name>fluxmon</user-name>
       <password>fluxmon</password>
       <metadata>
       <type-mapping>PostgreSQL 8.0</type-mapping>
       </metadata>
      
       </local-tx-datasource>
      </datasources>
      


      Database content/result of queries
      fluxmon=> SELECT PASSWORD FROM CLOCKER_USERS WHERE PHONENUMBER='+4797516690';
       password
      ------------------------------
       7EDGLd8tLX01PmrX0eNSm7aGfg8=
      (1 rad)
      
      fluxmon=> SELECT Role, 'Roles' FROM CLOCKER_USERS WHERE PHONENUMBER='+4797516690';
       role | ?column?
      ------+----------
       user | Roles
      (1 rad)
      
      fluxmon=>
      



      Exception:
      2008-01-21 21:22:51,663 TRACE [org.jboss.security.plugins.JaasSecurityManager] Constructing
      2008-01-21 21:22:51,664 DEBUG [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] CallbackHandler: org.jboss.security.auth.callback.SecurityAssociationHandler@10bfedd
      2008-01-21 21:22:51,664 DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@896e10
      2008-01-21 21:22:51,665 DEBUG [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] CachePolicy set to: org.jboss.util.TimedCachePolicy@991d56
      2008-01-21 21:22:51,665 DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@991d56
      2008-01-21 21:22:51,665 DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] Added fluxmonClocker, org.jboss.security.plugins.SecurityDomainContext@5532da to map
      2008-01-21 21:22:51,665 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] Begin isValid, principal:+4797516690, cache info: null
      2008-01-21 21:22:51,665 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] defaultLogin, principal=+4797516690
      2008-01-21 21:22:51,666 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] Begin getAppConfigurationEntry(fluxmonClocker), size=8
      2008-01-21 21:22:51,666 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] End getAppConfigurationEntry(fluxmonClocker), authInfo=AppConfigurationEntry[]:
      [0]
      LoginModule Class: org.jboss.security.auth.spi.DatabaseServerLoginModule
      ControlFlag: LoginModuleControlFlag: required
      Options:name=principalsQuery, value=SELECT PASSWORD FROM CLOCKER_USERS WHERE PHONENUMBER=?
      name=unauthenticatedIdentity, value=guest
      name=dsJndiName, value=java:/FluxMonClockerDS
      name=rolesQuery, value=SELECT ROLE, 'Roles' FROM CLOCKER_USERS WHERE PHONENUMBER=?
      
      2008-01-21 21:22:51,672 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] initialize, instance=@19690316
      2008-01-21 21:22:51,672 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Security domain: fluxmonClocker
      2008-01-21 21:22:51,678 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Saw unauthenticatedIdentity=guest
      2008-01-21 21:22:51,679 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] DatabaseServerLoginModule, dsJndiName=java:/FluxMonClockerDS
      2008-01-21 21:22:51,679 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] principalsQuery=SELECT PASSWORD FROM CLOCKER_USERS WHERE PHONENUMBER=?
      2008-01-21 21:22:51,679 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] rolesQuery=SELECT ROLE, 'Roles' FROM CLOCKER_USERS WHERE PHONENUMBER=?
      2008-01-21 21:22:51,679 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendResume=true
      2008-01-21 21:22:51,679 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] login
      2008-01-21 21:22:51,681 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendAnyTransaction
      2008-01-21 21:22:51,683 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] resumeAnyTransaction
      2008-01-21 21:22:51,685 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] abort
      2008-01-21 21:22:51,685 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] Login failure
      javax.security.auth.login.LoginException: java.lang.NullPointerException
       at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:141)
       at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:206)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
       at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
       at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
       at java.security.AccessController.doPrivileged(Native Method)
       at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
       at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
       at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:603)
       at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:537)
       at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
       at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491)
       at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:180)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:619)
      
       at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872)
       at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
       at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
       at java.security.AccessController.doPrivileged(Native Method)
       at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
       at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
       at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:603)
       at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:537)
       at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
       at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491)
       at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:180)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:619)
      2008-01-21 21:22:51,685 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] End isValid, false
      2008-01-21 21:22:51,685 TRACE [org.jboss.security.SecurityAssociation] clear, server=true
      


        • 1. Re: NullPointerException @ DatabaseServerLoginModule.java:14

          Slight update:

          I downloaded the source for the correct release of JBoss AS, where the faulting line is:

          (140) DataSource ds = (DataSource) ctx.lookup(dsJndiName);
          (141) conn = ds.getConnection();
          


          Now, the strange thing is that ds is null no matter what the
          datasource is set to in login-config.xml.
          Even not setting it (making it default to java:/DefaultDS (with HSQL)) yields a NPE at this point.

          What's even more strange is that a JPA/Hibernate model in the same EAR uses the same datasource, and this works flawlessly.

          The log clearly states:
          15:31:57,342 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=FluxMonClockerDS' to JNDI name 'java:FluxMonClockerDS'
          


          As I wrote in the previous post -- all help is appreciated!

          • 2. Re: NullPointerException @ DatabaseServerLoginModule.java:14
            jaikiran

            That's strange. I would have expected a NamenotFoundException or NamingException if it was a problem with the lookup. Can you post the output of the JNDI tree, which can be accessed as follows:


            - Go to http://< server>:< port>/jmx-console (Ex: http://localhost:8080/jmx-console)
            - Search for service=JNDIView on the jmx-console page
            - Click on that link
            - On the page that comes up click on the Invoke button beside the list() method
            - The page that comes up will show the contents of the JNDI tree.

            Post the output here.

            Also, try removing the DOCTYPE declaration from your ds.xml file as follows and see if it works:

            <?xml version="1.0" encoding="UTF-8"?>
            
            <datasources>
             <local-tx-datasource>
             <jndi-name>FluxMonClockerDS</jndi-name>
            
             <connection-url>
             jdbc:postgresql://localhost:5432/fluxmon
             </connection-url>
             <driver-class>org.postgresql.Driver</driver-class>
             <user-name>fluxmon</user-name>
             <password>fluxmon</password>
             <metadata>
             <type-mapping>PostgreSQL 8.0</type-mapping>
             </metadata>
            
             </local-tx-datasource>
            </datasources>


            Which version of JBoss are you using?

            • 3. Re: NullPointerException @ DatabaseServerLoginModule.java:14

              Hello, and thanks for the reply.

              Removing the DOCTYPE did not help.

              The version i JBoss 4.2.2.GA.

              Web Applications
              
              java:comp namespace of the http-invoker.sar/invoker.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/jmx-console] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/jmx-console/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/jmx-console] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/jmx-console] (class: javax.naming.LinkRef)
              
              
              java:comp namespace of the jbossws.sar/jbossws-context.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)
              
              
              java:comp namespace of the jbossmq-httpil.sar/jbossmq-httpil.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/jbossmq] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/jbossmq/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/jbossmq] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/jbossmq] (class: javax.naming.LinkRef)
              
              
              java:comp namespace of the app-clocker-ear-1.0-SNAPSHOT.ear/app-clocker-ws-1.0-SNAPSHOT.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/fluxmonClocker] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/fluxmonClocker/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/fluxmonClocker] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/fluxmonClocker] (class: javax.naming.LinkRef)
              
              
              java:comp namespace of the console-mgr.sar/web-console.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)
              
              
              java:comp namespace of the jmx-console.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)
              
              
              java:comp namespace of the app-clocker-wui.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)
              
              
              java:comp namespace of the jboss-web.deployer/ROOT.war application:
              
               +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
               +- env (class: org.jnp.interfaces.NamingContext)
               | +- security (class: org.jnp.interfaces.NamingContext)
               | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
               | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
               | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)
              
              
              java: Namespace
              
               +- jaas (class: javax.naming.Context)
               | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
               | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
               | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
               +- TransactionPropagationContextImporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
               +- comp.ejb3 (class: javax.naming.Context)
               | NonContext: null
               +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
               +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
               +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
               +- TransactionManager (class: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate)
               +- TransactionPropagationContextExporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
               +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
               +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
               +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
               +- Mail (class: javax.mail.Session)
               +- comp.original (class: javax.namingMain.Context)
               +- timedCacheFactory (class: javax.naming.Context)
              Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
               +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
               +- FluxMonClockerDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
               +- comp (class: javax.naming.Context)
               +- FluxMonAuthDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
              
              
              Global JNDI Namespace
              
               +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
               +- jmx (class: org.jnp.interfaces.NamingContext)
               | +- invoker (class: org.jnp.interfaces.NamingContext)
               | | +- RMIAdaptor (proxy: $Proxy47 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
               | +- rmi (class: org.jnp.interfaces.NamingContext)
               | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
               +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
               +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
               +- fluxmon-clocker (class: org.jnp.interfaces.NamingContext)
               | +- ConfigurationServiceBean (class: org.jnp.interfaces.NamingContext)
               | | +- local (proxy: $Proxy86 implements interface com.fluxmon.clocker.beans.ConfigurationServiceLocal,interface org.jboss.ejb3.JBossProxy)
               | | +- remote (proxy: $Proxy84 implements interface com.fluxmon.clocker.beans.ConfigurationServiceRemote,interface org.jboss.ejb3.JBossProxy)
               +- UserTransactionSessionFactory (proxy: $Proxy14 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
               +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
               +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
               +- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
               +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
               +- app-clocker-ear-1.0-SNAPSHOT (class: org.jnp.interfaces.NamingContext)
               | +- ReportingServiceBean (class: org.jnp.interfaces.NamingContext)
               | | +- local (proxy: $Proxy89 implements interface com.fluxmon.clocker.beans.ReportingService,interface org.jboss.ejb3.JBossProxy)
               | +- TimeReportServiceBean (class: org.jnp.interfaces.NamingContext)
               | | +- local (proxy: $Proxy92 implements interface com.fluxmon.clocker.beans.TimeReportService,interface org.jboss.ejb3.JBossProxy)
               +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
               +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
               +- queue (class: org.jnp.interfaces.NamingContext)
               | +- A (class: org.jboss.mq.SpyQueue)
               | +- testQueue (class: org.jboss.mq.SpyQueue)
               | +- ex (class: org.jboss.mq.SpyQueue)
               | +- DLQ (class: org.jboss.mq.SpyQueue)
               | +- D (class: org.jboss.mq.SpyQueue)
               | +- C (class: org.jboss.mq.SpyQueue)
               | +- B (class: org.jboss.mq.SpyQueue)
               +- topic (class: org.jnp.interfaces.NamingContext)
               | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
               | +- testTopic (class: org.jboss.mq.SpyTopic)
               | +- securedTopic (class: org.jboss.mq.SpyTopic)
               +- console (class: org.jnp.interfaces.NamingContext)
               | +- PluginManager (proxy: $Proxy48 implements interface org.jboss.console.manager.PluginManagerMBean)
               +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
               +- persistence.units:ear=app-clocker-ear-1.0-SNAPSHOT.ear,jar=app-clocker-svc-1.0-SNAPSHOT.ejb3.jar,unitName=FluxMonClocker (class: org.hibernate.impl.SessionFactoryImpl)
               +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
               +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
               +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
               +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
              
              


              Thanks

              • 4. Re: NullPointerException @ DatabaseServerLoginModule.java:14
                jaikiran

                The output looks fine to me. Where are you using this login module? I mean are you doing a programmatic login or are you using this login module for securing a web-application.

                • 5. Re: NullPointerException @ DatabaseServerLoginModule.java:14

                  It's used in securing a web-app.

                  The web.xml config is shown below - it seems to be correct, as the login-module is invoked with the proper input (username/password/dsJndiName).

                  I'm starting to think it's some environmental or contextual setting that
                  affects the server.

                   <security-constraint>
                   <web-resource-collection>
                   <web-resource-name>*</web-resource-name>
                   <url-pattern>/*</url-pattern>
                   <http-method>GET</http-method>
                   <http-method>DELETE</http-method>
                   <http-method>POST</http-method>
                   <http-method>PUT</http-method>
                   </web-resource-collection>
                   <auth-constraint>
                   <role-name>administrator</role-name>
                   <role-name>manager</role-name>
                   <role-name>user</role-name>
                   </auth-constraint>
                   </security-constraint>
                  
                   <login-config>
                   <auth-method>BASIC</auth-method>
                   <realm-name>fluxmonClocker</realm-name>
                   </login-config>
                  


                  For reference, the startup log:
                  19:14:55,637 INFO [Server] Starting JBoss (MX MicroKernel)...
                  19:14:55,638 INFO [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)
                  19:14:55,641 INFO [Server] Home Dir: /home/jhb/jboss-4.2.2.GA
                  19:14:55,641 INFO [Server] Home URL: file:/home/jhb/jboss-4.2.2.GA/
                  19:14:55,642 INFO [Server] Patch URL: null
                  19:14:55,642 INFO [Server] Server Name: default
                  19:14:55,642 INFO [Server] Server Home Dir: /home/jhb/jboss-4.2.2.GA/server/default
                  19:14:55,643 INFO [Server] Server Home URL: file:/home/jhb/jboss-4.2.2.GA/server/default/
                  19:14:55,643 INFO [Server] Server Log Dir: /home/jhb/jboss-4.2.2.GA/server/default/log
                  19:14:55,643 INFO [Server] Server Temp Dir: /home/jhb/jboss-4.2.2.GA/server/default/tmp
                  19:14:55,643 INFO [Server] Root Deployment Filename: jboss-service.xml
                  19:14:56,566 INFO [ServerInfo] Java version: 1.6.0_02,Sun Microsystems Inc.
                  19:14:56,567 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.6.0_02-b05,Sun Microsystems Inc.
                  19:14:56,567 INFO [ServerInfo] OS-System: Linux 2.6.22-14-generic,i386
                  
                  


                  • 6. Re: NullPointerException @ DatabaseServerLoginModule.java:14

                    So, I've debugged deep into the JNDI SPI - and I've tracked the "null" happening in orb.jboss.util.naming.NonSerializableFactory.

                     public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env)
                     throws Exception
                     { // Get the nns value from the Reference obj and use it as the map key
                     Reference ref = (Reference) obj;
                     RefAddr addr = ref.get("nns");
                     String key = (String) addr.getContent(); // = java:/FluxMonClockerDS
                     Object target = wrapperMap.get(key); // Return null
                     return target;
                     }
                    


                    Seeing this I added a method breakpoint in the bind() method and restarted JBoss.
                    The only breakpoint I got was for "java:/Mail".

                    So to check this, I changed the dsJndiName for the DatabaseServerLoginModule to "java:/Mail".
                    Restarted and initiated a new login - and presto; ClassCastException instead of NPE.
                    (noting that javax.mail.Session cannot be cast to javax.sql.Datasource).

                    So I presume this would be indicative of some fault in the JNDI configuration - although I don't quite see why...?

                    • 7. Re: NullPointerException @ DatabaseServerLoginModule.java:14
                      jaikiran

                       

                      19:14:56,566 INFO [ServerInfo] Java version: 1.6.0_02,Sun Microsystems Inc.
                      19:14:56,567 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.6.0_02-b05,Sun Microsystems In
                      c.


                      The first thing, i would suggest it to use Java 1.5 because JBoss is not yet fully qualified to work with Java 1.6

                      Also, did you by any chance edit the jndi.properties file in the server/default/conf folder? Or do you include any jndi.properties file in your application package?

                      What are the changes that you have done (if any) to the server configurations on a freshly installed JBoss?

                      • 8. Re: NullPointerException @ DatabaseServerLoginModule.java:14

                         

                        The first thing, i would suggest it to use Java 1.5 because JBoss is not yet fully qualified to work with Java 1.6


                        Sure, I'll give it a go - however, since the JNDI lookups work perfectly well from a EJB3 with a JPA/Hibernate backend, I'm going to be reasonably surprised if this solves the problem ;-)

                        Also, did you by any chance edit the jndi.properties file in the server/default/conf folder? Or do you include any jndi.properties file in your application package?


                        Nope - bog standard.

                        What are the changes that you have done (if any) to the server configurations on a freshly installed JBoss?



                        Added postgresql jdbc3 driver in lib/
                        Edited login-conf.xml to receive the authentication-policy
                        Enabled TRACE on org.jboss.security in jboss-log4j.xml


                        I'll give JDK 1.5.0_14 a go, and post back.

                        • 9. Re: NullPointerException @ DatabaseServerLoginModule.java:14

                          Well, paint be baffled.

                          Seems JDK 1.6 indeed was the error.
                          (checked it by setting the JMX console to use the authentication-policy)

                          So it would seem I have to re-package my application to use jboss's JAR files for 1.6 compatible annotations, then.

                          Thanks for your help, appreciated!

                          • 10. Re: NullPointerException @ DatabaseServerLoginModule.java:14

                            Ha! Famous last words!

                            Well, at least I now know that the cause of the problem is somehow embedded in my EAR.

                            Log excerpt that shows first a login attempt to the EAR contained GWT application, then a login attempt to the JMX console.
                            Both uses the same security-domain, but the first fails with the afore mentioned NPE and the last with a gracefull error message (expected)

                            2008-01-23 08:49:05,735 TRACE [org.jboss.security.plugins.JaasSecurityManager] Constructing
                            2008-01-23 08:49:05,735 DEBUG [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] CallbackHandler: org.jboss.security.auth.callback.SecurityAssociationHandler@2c4120aa
                            2008-01-23 08:49:05,735 DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@67c78f98
                            2008-01-23 08:49:05,736 DEBUG [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] CachePolicy set to: org.jboss.util.TimedCachePolicy@5ea47962
                            2008-01-23 08:49:05,736 DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@5ea47962
                            2008-01-23 08:49:05,736 DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] Added fluxmonClocker, org.jboss.security.plugins.SecurityDomainContext@1d4179 to map
                            2008-01-23 08:49:05,736 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] Begin isValid, principal:+4797516690, cache info: null
                            2008-01-23 08:49:05,736 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] defaultLogin, principal=+4797516690
                            2008-01-23 08:49:05,736 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] Begin getAppConfigurationEntry(fluxmonClocker), size=8
                            2008-01-23 08:49:05,736 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] End getAppConfigurationEntry(fluxmonClocker), authInfo=AppConfigurationEntry[]:
                            [0]
                            LoginModule Class: org.jboss.security.auth.spi.DatabaseServerLoginModule
                            ControlFlag: LoginModuleControlFlag: required
                            Options:name=rolesQuery, value=SELECT ROLE, 'Roles' FROM CLOCKER_USERS WHERE PHONENUMBER=?
                            name=principalsQuery, value=SELECT PASSWORD FROM CLOCKER_USERS WHERE PHONENUMBER=?
                            name=unauthenticatedIdentity, value=guest
                            name=dsJndiName, value=java:/FluxMonAuthDS
                            
                            2008-01-23 08:49:05,741 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] initialize, instance=@410572006
                            2008-01-23 08:49:05,741 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Security domain: fluxmonClocker
                            2008-01-23 08:49:05,741 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Saw unauthenticatedIdentity=guest
                            2008-01-23 08:49:05,742 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] DatabaseServerLoginModule, dsJndiName=java:/FluxMonAuthDS
                            2008-01-23 08:49:05,742 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] principalsQuery=SELECT PASSWORD FROM CLOCKER_USERS WHERE PHONENUMBER=?
                            2008-01-23 08:49:05,742 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] rolesQuery=SELECT ROLE, 'Roles' FROM CLOCKER_USERS WHERE PHONENUMBER=?
                            2008-01-23 08:49:05,742 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendResume=true
                            2008-01-23 08:49:05,742 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] login
                            2008-01-23 08:49:05,743 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendAnyTransaction
                            2008-01-23 08:49:05,746 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] resumeAnyTransaction
                            2008-01-23 08:49:05,755 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] abort
                            2008-01-23 08:49:05,755 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] Login failure
                            javax.security.auth.login.LoginException: java.lang.NullPointerException
                             at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:141)
                             at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:206)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                             at java.lang.reflect.Method.invoke(Method.java:585)
                             at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
                             at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
                             at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
                             at java.security.AccessController.doPrivileged(Native Method)
                             at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
                             at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
                             at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:603)
                             at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:537)
                             at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
                             at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491)
                             at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:180)
                             at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
                             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                             at java.lang.Thread.run(Thread.java:595)
                            
                             at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872)
                             at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
                             at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
                             at java.security.AccessController.doPrivileged(Native Method)
                             at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
                             at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
                             at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:603)
                             at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:537)
                             at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
                             at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491)
                             at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:180)
                             at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
                             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                             at java.lang.Thread.run(Thread.java:595)
                            2008-01-23 08:49:05,756 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] End isValid, false
                            2008-01-23 08:49:05,756 TRACE [org.jboss.security.SecurityAssociation] clear, server=true
                            2008-01-23 08:49:48,652 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - first pass <Wed, 23 Jan 2008 08:49:48>
                            2008-01-23 08:49:48,652 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] StatusModule: first pass
                            2008-01-23 08:49:48,652 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_3] - TORecoveryModule - first pass
                            2008-01-23 08:49:48,653 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.firstpass] Local XARecoveryModule - first pass
                            2008-01-23 08:49:58,670 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - second pass <Wed, 23 Jan 2008 08:49:58>
                            2008-01-23 08:49:58,670 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] AtomicActionRecoveryModule: Second pass
                            2008-01-23 08:49:58,670 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_6] - TORecoveryModule - second pass
                            2008-01-23 08:49:58,670 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.secondpass] Local XARecoveryModule - second pass
                            2008-01-23 08:49:59,635 TRACE [org.jboss.security.SecurityAssociation] clear, server=true
                            2008-01-23 08:50:09,707 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] Begin isValid, principal:+4797516690, cache info: null
                            2008-01-23 08:50:09,707 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] defaultLogin, principal=+4797516690
                            2008-01-23 08:50:09,707 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] Begin getAppConfigurationEntry(fluxmonClocker), size=8
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] End getAppConfigurationEntry(fluxmonClocker), authInfo=AppConfigurationEntry[]:
                            [0]
                            LoginModule Class: org.jboss.security.auth.spi.DatabaseServerLoginModule
                            ControlFlag: LoginModuleControlFlag: required
                            Options:name=rolesQuery, value=SELECT ROLE, 'Roles' FROM CLOCKER_USERS WHERE PHONENUMBER=?
                            name=principalsQuery, value=SELECT PASSWORD FROM CLOCKER_USERS WHERE PHONENUMBER=?
                            name=unauthenticatedIdentity, value=guest
                            name=dsJndiName, value=java:/FluxMonAuthDS
                            
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] initialize, instance=@149976429
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Security domain: fluxmonClocker
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Saw unauthenticatedIdentity=guest
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] DatabaseServerLoginModule, dsJndiName=java:/FluxMonAuthDS
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] principalsQuery=SELECT PASSWORD FROM CLOCKER_USERS WHERE PHONENUMBER=?
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] rolesQuery=SELECT ROLE, 'Roles' FROM CLOCKER_USERS WHERE PHONENUMBER=?
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendResume=true
                            2008-01-23 08:50:09,708 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] login
                            2008-01-23 08:50:09,709 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendAnyTransaction
                            2008-01-23 08:50:09,709 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 450000
                            2008-01-23 08:50:09,716 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Excuting query: SELECT PASSWORD FROM CLOCKER_USERS WHERE PHONENUMBER=?, with username: +4797516690
                            2008-01-23 08:50:09,753 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Obtained user password
                            2008-01-23 08:50:09,753 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] resumeAnyTransaction
                            2008-01-23 08:50:09,753 DEBUG [org.jboss.security.auth.spi.DatabaseServerLoginModule] Bad password for username=+4797516690
                            2008-01-23 08:50:09,753 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] abort
                            2008-01-23 08:50:09,753 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] Login failure
                            javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required
                             at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:213)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                             at java.lang.reflect.Method.invoke(Method.java:585)
                             at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
                             at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
                             at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
                             at java.security.AccessController.doPrivileged(Native Method)
                             at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
                             at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
                             at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:603)
                             at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:537)
                             at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
                             at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491)
                             at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:180)
                             at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
                             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                             at java.lang.Thread.run(Thread.java:595)
                            2008-01-23 08:50:09,754 TRACE [org.jboss.security.plugins.JaasSecurityManager.fluxmonClocker] End isValid, false
                            2008-01-23 08:50:09,754 TRACE [org.jboss.security.SecurityAssociation] clear, server=true
                            


                            I'll keep digging into my own mess, and post the resolution here - for future references. :-)

                            • 11. SOLVED: Re: NullPointerException @ DatabaseServerLoginModule

                              So it would seem that you need to enable

                              <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
                              


                              in jboss-web.deployer/server.xml!

                              Even though there's only one web-app in the EAR... weird.

                              Anyway - now it's OK, thanks.

                              • 12. Re: NullPointerException @ DatabaseServerLoginModule.java:14
                                mactex

                                I get exactly the same error message when trying to use the Databaseserver loginmodule. I use JBoss 4.2.3. In the log there is the following:

                                javax.security.auth.login.LoginException: java.lang.NullPointerException
                                 at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:141)
                                 at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:206)
                                


                                It seems from the source file, that the Datasource returned is null. It's the following source in the login module:

                                InitialContext ctx = new InitialContext();
                                 DataSource ds = (DataSource) ctx.lookup(dsJndiName);
                                 conn = ds.getConnection();
                                


                                I configured everything from the documentation.
                                login-config.xml:
                                <application-policy name = "nedbDbLogin">
                                 <authentication>
                                 <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
                                 flag="required">
                                 <module-option name="dsJndiName">java:jdbc/bavnedb</module-option>
                                 <!--<module-option name="hashAlgorithm">MD5</module-option>
                                 <module-option name="hashEncoding">base64</module-option> -->
                                 <module-option name="principalsQuery">
                                 select password from USER where LOGIN_ID=?</module-option>
                                 <module-option name="rolesQuery">
                                 select 'Nedb_User', 'Roles' from USER where LOGIN_ID=?</module-option>
                                 </login-module>
                                 </authentication>
                                 </application-policy>
                                


                                jboss-web.xml:
                                <?xml version="1.0" encoding="UTF-8"?>
                                <jboss-web>
                                <security-domain>java:/jaas/nedbDbLogin</security-domain>
                                </jboss-web>


                                The code for the programmatic login:
                                UsernamePasswordHandler handler = new UsernamePasswordHandler(userId, password);
                                
                                 LoginContext loginContext = new LoginContext(LOGIN_CONTEXT,
                                 (CallbackHandler) handler);
                                 loginContext.login();
                                


                                Do you have any idea what can be wrong?

                                Thanks in advance

                                • 13. Re: NullPointerException @ DatabaseServerLoginModule.java:14
                                  kagato11

                                  Hi,
                                  I've the same problem as mactex. Struggling for 3 days with:

                                  javax.security.auth.login.LoginException: java.lang.NullPointerException


                                  I try to use database as user repository in Drools 4 BRMS or Drools 5 Guvnor. Got similar configuration as mactex except that I had to point policy from login-config.xml in the components.xml file of the guvnor/brms:
                                  <security:identity authenticate-method="#{authenticator.authenticate}" jaas-config-name="oracleDS"/>


                                  conn = ds.getConnection(); returns null. Please can anyone help us?

                                  • 14. Re: NullPointerException @ DatabaseServerLoginModule.java:14
                                    kagato11

                                    a little update. Now I know that ctx.lookup(dsJndiName); returns null. dsJndiName is bounded otherwise if I write there some wrong string like ctx.lookup("blablabla'); I get error that "blablabla" was not bound, so my dsJndiName is bounded, but empty?

                                    1 2 Previous Next