13 Replies Latest reply on Nov 27, 2015 4:21 AM by veeramanipalanisamy

    Authentication exception, principal=null  error in Jboss 5 startup

    amathewjboss1

      Hi,

       

        I am trying to migrate our application from Jboss 4.0.3 to  JBoss_5_1_0_GA. I am getting the below error while invoking a EJB method:

       

       

      12:31:03,246 ERROR [SecurityInterceptor] Error in Security Interceptor java.lang.SecurityException: Authentication exception, principal=null

             at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityContext(SecurityInterceptor.java:321)

             at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:243)

             at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:205)

             at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:136)

             at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invokeHome(PreSecurityInterceptor.java:88)

             at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)

             at org.jboss.ejb.plugins.CleanShutdownInterceptor.invokeHome(CleanShutdownInterceptor.java:216)

             at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)

             at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:639)

             at org.jboss.ejb.Container.invoke(Container.java:1046)

             at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)

             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

             at java.lang.reflect.Method.invoke(Method.java:597)

       

      Below is from ejb-jar.xml file:

      -------------------------------------------

       

      <assembly-descriptor>

         <security-role>principal_for_system</security-role>

          ---

      </assembly-descriptor>

       

      Below is from my all.pvo/conf/login-config.xml file

      ---------------------------------------------------------------------

       

      <application-policy name="jwdomain">

            <authentication>

                 <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"         flag="required">

                      <module-option name="principal">PVOADMINP</module-option>

                      <module-option name="userName">pvoadmin</module-option>

                      <module-option name="password">pvoadmin</module-option>

                      <module-option name="usersProperties">props/jbosspvo-users.properties</module-option>

                      <module-option name="rolesProperties">props/jbosspvo-roles.properties</module-option>

                 </login-module>

           <authentication>

      <application-policy>

       

      Below is my jboss.xml

      --------------------------------

       

      <jboss>

           <security-domain>java:/jaas/jwdomain</security-domain>

           <enterprise-beans>

       

              ---

      </jboss>

       

       

      I enabled the Jboss TRACE and i am getting the below info:

      -------------------------------------------------------------------------------------

       

       

      2010-07-08 12:31:03,241 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.jwdomain] (main) defaultLogin, principal=null 2010-07-08 12:31:03,241 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] (main) Begin getAppConfigurationEntry(jwdomain), size=12 2010-07-08 12:31:03,241 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] (main) End getAppConfigurationEntry(jwdomain), authInfo=AppConfigurationEntry[]: [0]

       

      LoginModule Class: org.jboss.security.auth.spi.UsersRolesLoginModule

      ControlFlag: LoginModuleControlFlag: required

      Options:

      name=usersProperties, value=props/jbosspvo-users.properties

      name=principal, value=PVOADMINP

      name=userName, value=pvoadmin

      name=rolesProperties, value=props/jbosspvo-roles.properties

      name=password, value=****

       

      2010-07-08 12:31:03,242 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) initialize

      2010-07-08 12:31:03,242 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) Security domain: jwdomain

      2010-07-08 12:31:03,242 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) findResource: null

      2010-07-08 12:31:03,242 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) Properties file=vfsfile:/opt/pvo/cots/jboss-5.1.0.GA/server/all.pvo/conf/props/jbosspvo-users.properties, defaults=null

      2010-07-08 12:31:03,242 DEBUG [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) Loaded properties, users=[pvoadmin]

      2010-07-08 12:31:03,242 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) findResource: null

      2010-07-08 12:31:03,243 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) Properties file=vfsfile:/opt/pvo/cots/jboss-5.1.0.GA/server/all.pvo/conf/props/jbosspvo-roles.properties, defaults=null

      2010-07-08 12:31:03,243 DEBUG [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) Loaded properties, users=[pvoadmin]

      2010-07-08 12:31:03,243 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) login

      2010-07-08 12:31:03,243 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) Authenticating as unauthenticatedIdentity=null

      2010-07-08 12:31:03,243 DEBUG [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) Bad password for username=null

      2010-07-08 12:31:03,244 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] (main) abort

      2010-07-08 12:31:03,244 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.jwdomain] (main) Login failure

       

      javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required

               at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:252)    

              at org.jboss.security.auth.spi.UsersRolesLoginModule.login(UsersRolesLoginModule.java:152)

               ---     

       

              at java.lang.Thread.run(Thread.java:619)

             2010-07-08 12:31:03,237 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.jwdomain] (main) End isValid, false

             2010-07-08 12:31:03,237 TRACE [org.jboss.security.audit.providers.LogAuditProvider] (main) [Error]Source=org.jboss.security.javaee.EJBAuthenticationHelper;principal=null;method=create;

             javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required       

             at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:252)       

             at org.jboss.security.auth.spi.UsersRolesLoginModule.login(UsersRolesLoginModule.java:152)       

             at sun.reflect.GeneratedMethodAccessor351.invoke(Unknown Source)       

             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)       

             ----------

       

             2010-07-08 12:31:03,237 ERROR [org.jboss.ejb.plugins.SecurityInterceptor] (main) Error in Security Interceptor

             java.lang.SecurityException: Authentication exception, principal=null       

             at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityContext(SecurityInterceptor.java:321)       

             at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:243)       

             at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:205)       

             at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:136)

       

       

      Any thoughts why i am still getting these error. I have many hours on this now and still no luck. Please help me.

        • 1. Re: Authentication exception, principal=null  error in Jboss 5 startup
          wolfgangknauf

          Hi Anil,

           

          what kind of client do you use? Do you have a web app or a standalone application client?

           

          The client has to perform a login, and it seems that this does not happen in your app. Do you use a login against JNDI (see security FAQ at http://www.jboss.org/community/wiki/SecurityFAQ - answer 10)? This feature was removed in 5.0.

           

          By the way: JBoss 5.1 introduced a new way to configure security, instead of using "login-config.xml": http://server.dzone.com/articles/security-features-jboss-510

           

          Best regards

           

          Wolfgang

          • 2. Re: Authentication exception, principal=null  error in Jboss 5 startup
            amathewjboss1

            Thank you so much for the reply. Answering to your question:

             

            We have a web application as the client. I am seeing the error in the start up as we have many bootstrap classes which are trying to load data from DB (using EJB API's) and putting to cache. Of course i am seeing the same error while i run the web application too.

             

            I looked at the JNDI adaptor code which we have. It seems like we always setting the value of the below properties as null when we resolve the InitialContext:

             

            java.naming.security.principal

            java.naming.security.credentials

             

            Do you think this is my issue? In fact i set values for these property (to match the values in my users.properties and still didn't work).

             

            When you say "This feature was removed in 5.0." Did you mean to say login against JNDI option is removed in 5.0 and latter versions?

             

            Thank You

            Anil

            • 3. Re: Authentication exception, principal=null  error in Jboss 5 startup
              amathewjboss1

              I read the Security FAQ link and that basically solved my "null" principal issue.

               

              i.e I added the below code before the lookup call:

               

              SecurityClient securityClient = SecurityClientFactory.getSecurityClient();   

              securityClient.setSimple("user", "userpwd"); 

              securityClient.login();

               

              But the bad news is now i am getting the below error when my web app tries to invoke a EJB API:

               

              java.lang.ClassCastException: org.jboss.proxy.ejb.SecurityContextInterceptor cannot be cast to org.jboss.proxy.Interceptor

               

              Any thoughts on this please?

              • 4. Re: Authentication exception, principal=null  error in Jboss 5 startup
                wolfgangknauf

                Hi,

                 

                does your webclient WAR file or the EJB Jar file contain any JBoss classes? The exception sounds like this.

                 

                Best regards

                 

                Wolfgang

                • 5. Re: Authentication exception, principal=null  error in Jboss 5 startup
                  amathewjboss1

                  Thanks again for the valuable replies you are giving.

                   

                  In order for the new code to compile, I will have to update my maven pom files to have the below 2 jars:

                   

                  <dependency>
                                                  <groupId>jboss</groupId>
                                                  <artifactId>jboss-security-spi</artifactId>
                                                  <version>2.0.4</version>
                                                  <type>jar</type>
                                                  <scope>provided</scope>
                                          </dependency>
                                          <dependency>
                                                  <groupId>jboss</groupId>
                                                  <artifactId>jbosssx</artifactId>
                                                  <version>2.0.4</version>
                                                  <type>jar</type>
                                                  <scope>provided</scope>
                                          </dependency>

                   

                  So do you mean to say this is causing the issue? If so i assume i need these jars to have the code in my application.

                   

                  Thanks

                  Anil

                  • 6. Re: Authentication exception, principal=null  error in Jboss 5 startup
                    wolfgangknauf

                    Hi Anil,

                     

                    I don't know Maven, but I think that the  "scope" of "provided" should be correct here (include the files at compile time, but don't deploy).

                     

                    Could you please check what jars/classes are included in the deployed WAR and EJB jar file? Could you post the result of "jar -tf MyApp.war"?

                     

                    Best regards

                     

                    Wolfgang

                    • 7. Re: Authentication exception, principal=null  error in Jboss 5 startup
                      amathewjboss1

                      I wanted to reply back yesterday night, but it was too late. I was able to narrow down the "provided" vs "compile" in the maven and i was able to fix that issue.

                       

                      But the bad news is now i am getting the below error when i try to run my application.

                       

                       

                      Caused by: java.lang.NoSuchMethodError: org.jboss.ha.framework.interfaces.FamilyClusterInfo.getTargets()Ljava/util/ArrayList;

                      at com.pvo.util.ejb.EJBRouterJBoss.defaultChooseTarget(EJBRouterJBoss.java:164)
                              at com.pvo.util.ejb.EJBRouterJBoss.chooseTarget(EJBRouterJBoss.java:154)
                              at org.jboss.invocation.unified.interfaces.UnifiedInvokerHAProxy.getClient(UnifiedInvokerHAProxy.java:161)
                              at org.jboss.invocation.unified.interfaces.UnifiedInvokerHAProxy.invoke(UnifiedInvokerHAProxy.java:204)
                              ... 19 more

                       

                      Note that currently we are running on Jboss 4.0.3. Any thoughts on this please? I think i am really close on running my application on JBoss 5.1.0.

                       

                      Again i can't stop thanking you for your replies.

                       

                       

                      Regards

                      Anil

                      • 8. Re: Authentication exception, principal=null  error in Jboss 5 startup
                        amathewjboss1

                        I think I found the below issue (java.lang.NoSuchMethodError: org.jboss.ha.framework.interfaces.FamilyClusterInfo) which i was mentioning. But that leads me to a very core question.

                         

                        i.e  Does JBoss5.1.0.GA has the intra-VM EJB optimization feature? i.e Will it(Jboss_5.1.0) use a local EJB even for a remote call if the reqested EJB is deployed on the local server? This behavior was breaking one of the functionality we have in our application (where some EJB calls do need to be remote, and must be serviced by another node).

                         

                        Can you please let me know your thoughts on this?

                        • 9. Re: Authentication exception, principal=null  error in Jboss 5 startup
                          amathewjboss1

                          It seems like i still have  "java.lang.NoSuchMethodError: org.jboss.ha.framework.interfaces.FamilyClusterInfo" error. I have spend 3 days on fixing this issue and still no luck. Can you please give me any insight to this issue please (as i am totally stuck now).?

                          • 10. Re: Authentication exception, principal=null  error in Jboss 5 startup
                            jaikiran

                            Anil Mathew wrote:

                             

                            I wanted to reply back yesterday night, but it was too late. I was able to narrow down the "provided" vs "compile" in the maven and i was able to fix that issue.

                             

                            But the bad news is now i am getting the below error when i try to run my application.

                             

                             

                            Caused by: java.lang.NoSuchMethodError: org.jboss.ha.framework.interfaces.FamilyClusterInfo.getTargets()Ljava/util/ArrayList;

                            at com.pvo.util.ejb.EJBRouterJBoss.defaultChooseTarget(EJBRouterJBoss.java:164)
                                    at com.pvo.util.ejb.EJBRouterJBoss.chooseTarget(EJBRouterJBoss.java:154)
                                    at org.jboss.invocation.unified.interfaces.UnifiedInvokerHAProxy.getClient(UnifiedInvokerHAProxy.java:161)
                                    at org.jboss.invocation.unified.interfaces.UnifiedInvokerHAProxy.invoke(UnifiedInvokerHAProxy.java:204)
                                    ... 19 more

                             

                            Note that currently we are running on Jboss 4.0.3. Any thoughts on this please? I think i am really close on running my application on JBoss 5.1.0.

                             

                            You shouldn't be seeing that error, unless you packaged any JBoss specific jars in your application. Do you have any such jars?

                            • 11. Re: Authentication exception, principal=null  error in Jboss 5 startup
                              amathewjboss1

                              Thank you so much for the response.  I am attaching a file which has all the jar files which i have it on my ear file (which we copy under all/deploy directory).

                               

                              I don't see any Jboss specific jar in the pacjkage. Can you please take a look?

                              • 12. Re: Authentication exception, principal=null  error in Jboss 5 startup
                                amathewjboss1

                                I spend 2 days looking into each jar which i attached in my earlier reply and still i don't see any jboss jar. Can some one please help me on this? I am totally stuck and i think this is last piece i need to fix in order to start using my Jboss5.1.0.

                                 

                                Thank You

                                Anil Mathew

                                • 13. Re: Authentication exception, principal=null  error in Jboss 5 startup
                                  veeramanipalanisamy

                                  Hi, Can you please give me if any solution on the above issue. Thanks.