9 Replies Latest reply on Aug 12, 2017 1:53 AM by Neville Camilleri

    javax.ejb.EJBAccessException: Authentication failure with no

    Eric Anderson Newbie

      I am trying to build a simple webapp / EJB 3.0 project. But running into some difficulty.

      After getting the session context bean, while trying to run a procedure that returns rows from a the DB, I get

      javax.ejb.EJBAccessException: Authentication failure

      Anyone know why? I don't even have @Security set.

      webkidsFacadeLocal.java

      package org.usiis.model;
      
      import java.util.List;
      
      import javax.ejb.Local;
      
      
      @Local
      public interface webkidsFacadeLocal {
       Object mergeEntity(Object entity);
      
       Object persistEntity(Object entity);
      
       List<Users> queryUsersFindAll();
      
       void removeUsers(Users users);
      
       List<UsersGlobal> queryUsersGlobalFindAll();
      
       void removeUsersGlobal(UsersGlobal usersGlobal);
      
       List<Providers> queryProvidersFindAll();
      
       void removeProviders(Providers providers);
      
       List<ProviderUsers> queryProviderUsersFindAll();
      
       void removeProviderUsers(ProviderUsers providerUsers);
      
       List<ProviderUserContactInfo> queryProviderUserContactInfoFindAll();
      
       void removeProviderUserContactInfo(ProviderUserContactInfo providerUserContactInfo);
      
       List<ProviderUserFuncs> queryProviderUserFuncsFindAll();
      
       void removeProviderUserFuncs(ProviderUserFuncs providerUserFuncs);
      
       List<ProviderUserRoles> queryProviderUserRolesFindAll();
      
       void removeProviderUserRoles(ProviderUserRoles providerUserRoles);
      
       List<ProviderUserServices> queryProviderUserServicesFindAll();
      
       void removeProviderUserServices(ProviderUserServices providerUserServices);
      
       List<Users> queryUsersFindAll(Object username, Object password,
       Object providerId);
      }
      



      webkidsFacadeBean
      
      package org.usiis.model;
      
      import java.util.List;
      
      import javax.ejb.Stateless;
      
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      
      @Stateless(name="webkidsFacade")
      public class webkidsFacadeBean implements webkidsFacade, webkidsFacadeLocal {
       @PersistenceContext(unitName="usiisUsts")
       private EntityManager em;
      
       public webkidsFacadeBean() {
       }
      
       public Object mergeEntity(Object entity) {
       return em.merge(entity);
       }
      
       public Object persistEntity(Object entity) {
       em.persist(entity);
       return entity;
       }
      
       /** <code>select o from Users o</code> */
       public List<Users> queryUsersFindAll() {
       return em.createNamedQuery("Users.findAll").getResultList();
       }
      
       public void removeUsers(Users users) {
       users = em.find(Users.class, users.getUserId());
       em.remove(users);
       }
      
       /** <code>select o from UsersGlobal o</code> */
       public List<UsersGlobal> queryUsersGlobalFindAll() {
       return em.createNamedQuery("UsersGlobal.findAll").getResultList();
       }
      
       public void removeUsersGlobal(UsersGlobal usersGlobal) {
       usersGlobal = em.find(UsersGlobal.class, usersGlobal.getUsersGlobalId());
       em.remove(usersGlobal);
       }
      
       /** <code>select o from Providers o</code> */
       public List<Providers> queryProvidersFindAll() {
       return em.createNamedQuery("Providers.findAll").getResultList();
       }
      
       public void removeProviders(Providers providers) {
       providers = em.find(Providers.class, providers.getProviderId());
       em.remove(providers);
       }
      
       /** <code>select o from ProviderUsers o</code> */
       public List<ProviderUsers> queryProviderUsersFindAll() {
       return em.createNamedQuery("ProviderUsers.findAll").getResultList();
       }
      
       public void removeProviderUsers(ProviderUsers providerUsers) {
       providerUsers = em.find(ProviderUsers.class, providerUsers.getProviderUserId());
       em.remove(providerUsers);
       }
      
       /** <code>select o from ProviderUserContactInfo o</code> */
       public List<ProviderUserContactInfo> queryProviderUserContactInfoFindAll() {
       return em.createNamedQuery("ProviderUserContactInfo.findAll").getResultList();
       }
      
       public void removeProviderUserContactInfo(ProviderUserContactInfo providerUserContactInfo) {
       providerUserContactInfo = em.find(ProviderUserContactInfo.class, providerUserContactInfo.getContactInfoId());
       em.remove(providerUserContactInfo);
       }
      
       /** <code>select o from ProviderUserFuncs o</code> */
       public List<ProviderUserFuncs> queryProviderUserFuncsFindAll() {
       return em.createNamedQuery("ProviderUserFuncs.findAll").getResultList();
       }
      
       public void removeProviderUserFuncs(ProviderUserFuncs providerUserFuncs) {
       providerUserFuncs = em.find(ProviderUserFuncs.class, providerUserFuncs.getUserFuncId());
       em.remove(providerUserFuncs);
       }
      
       /** <code>select o from ProviderUserRoles o</code> */
       public List<ProviderUserRoles> queryProviderUserRolesFindAll() {
       return em.createNamedQuery("ProviderUserRoles.findAll").getResultList();
       }
      
       public void removeProviderUserRoles(ProviderUserRoles providerUserRoles) {
       providerUserRoles = em.find(ProviderUserRoles.class, providerUserRoles.getUserRoleId());
       em.remove(providerUserRoles);
       }
      
       /** <code>select o from ProviderUserServices o</code> */
       public List<ProviderUserServices> queryProviderUserServicesFindAll() {
       return em.createNamedQuery("ProviderUserServices.findAll").getResultList();
       }
      
       public void removeProviderUserServices(ProviderUserServices providerUserServices) {
       providerUserServices = em.find(ProviderUserServices.class, providerUserServices.getUserServicesId());
       em.remove(providerUserServices);
       }
      
       /** <code>select o from Users o where o.username = :username and o.password = :password and o.providerUsersList.providers.providerId = :providerId</code> */
       public List<Users> queryUsersFindAll(Object username, Object password, Object providerId) {return em.createNamedQuery("Users.findAll").setParameter("username", username).setParameter("password", password).setParameter("providerId", providerId).getResultList();
       }
      }
      
      



      Problem code...

       final Context context = new InitialContext();
       webkidsFacadeLocal WebkidsFacade =
       (webkidsFacadeLocal) context.lookup("WebkidsAdminLite/webkidsFacade/local");
      
       List provs = WebkidsFacade.queryProvidersFindAll();
      



      Stack Trace
      15:39:20,105 ERROR [STDERR] javax.ejb.EJBAccessException: Authentication failure
      
      15:39:20,105 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInt
      erceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:99)
      15:39:20,105 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInte
      rceptor.invoke(AuthenticationInterceptor.java:70)
      15:39:20,105 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInt
      erceptor.invoke(Ejb3AuthenticationInterceptor.java:131)
      15:39:20,120 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo
      keNext(MethodInvocation.java:101)
      15:39:20,120 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invo
      ke(ENCPropagationInterceptor.java:47)
      15:39:20,120 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo
      keNext(MethodInvocation.java:101)
      15:39:20,120 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInter
      ceptor.invoke(AsynchronousInterceptor.java:106)
      15:39:20,120 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo
      keNext(MethodInvocation.java:101)
      15:39:20,120 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.l
      ocalInvoke(StatelessContainer.java:211)
      15:39:20,120 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessLocalProxy.
      invoke(StatelessLocalProxy.java:79)
      15:39:20,120 ERROR [STDERR] at $Proxy79.queryProvidersFindAll(Unknown Source
      )
      15:39:20,120 ERROR [STDERR] at org.usiis.view.backing.Login.<init>(Login.jav
      


        • 1. Re: javax.ejb.EJBAccessException: Authentication failure wit
          Eric Anderson Newbie

          What I don't understand is I haven't setup any secruity domains.. When I tried to access the EJB I got an error stating it could not find user.properties or roles.properties. So I added those.

          But all I am trying to do is access the sesssion facade from the war side. Does every EJB need security for it?

          • 3. Re: javax.ejb.EJBAccessException: Authentication failure wit
            Eric Anderson Newbie

            Ok I added the code from the EJB 3.0 trailblazer from jboss website and I am still getting the same problem.

            javax.ejb.EJBAccessException: Authentication failure
             at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSe
            curityException(Ejb3AuthenticationInterceptor.java:99)
             at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
            ationInterceptor.java:70)
             at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
            enticationInterceptor.java:131)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
            java:101)
             at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
            ptor.java:47)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
            java:101)
             at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
            usInterceptor.java:106)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
            java:101)
             at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessCont
            ainer.java:211)
             at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalPro
            xy.java:79)
             at $Proxy128.getFunds(Unknown Source)
             at org.apache.jsp.Calculator_jsp._jspService(Calculator_jsp.java:89)
             at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
             at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
            
            


            Notice the authentication error when trying to add funds. Exactly the same thing that the trailblazer is doing?



            • 4. Re: javax.ejb.EJBAccessException: Authentication failure wit
              Eric Anderson Newbie

              Ok I added the code from the EJB 3.0 trailblazer from jboss website and I am still getting the same problem.

              javax.ejb.EJBAccessException: Authentication failure
               at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSe
              curityException(Ejb3AuthenticationInterceptor.java:99)
               at org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authentic
              ationInterceptor.java:70)
               at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Auth
              enticationInterceptor.java:131)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
              java:101)
               at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
              ptor.java:47)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
              java:101)
               at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(Asynchrono
              usInterceptor.java:106)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
              java:101)
               at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessCont
              ainer.java:211)
               at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalPro
              xy.java:79)
               at $Proxy128.getFunds(Unknown Source)
               at org.apache.jsp.Calculator_jsp._jspService(Calculator_jsp.java:89)
               at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
               at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
              
              


              Notice the authentication error when trying to add funds. Exactly the same thing that the trailblazer is doing?



              • 5. Re: javax.ejb.EJBAccessException: Authentication failure wit
                Eric Anderson Newbie

                Looks like no one else has had this problem...

                I think it might be my compiler in JDeveloper. When I deploy using it I get these errors.

                But when I add my sources to the source project of the TrailBlazer EJB from jboss.org, and compile using the ant build script. It works fine.

                Hmmmmm

                • 6. Re: javax.ejb.EJBAccessException: Authentication failure with no
                  Volodymyr Mykhalchuk Newbie

                  We also face this problem.

                   

                  Same exception is raised sporadically after long execution of a transaction on our Production server, while on Test server everything works normal.

                   

                  P.S. JBoss4.2.2.GA + CentOS 5.4 + JVM build 1.6.0_17-b04

                  • 7. Re: javax.ejb.EJBAccessException: Authentication failure with no
                    Alexander Curvers Newbie

                    I have the same problem Jboss4.2.3GA  anyone found the cause of this problem?

                    • 8. Re: javax.ejb.EJBAccessException: Authentication failure with no
                      Volodymyr Mykhalchuk Newbie

                      Yes, we encountered this issue some time ago (see my comment above).

                      The problem was actually residing outsied, we are using a Virtual hosted environment, which is being maintained at 4am each day.

                      And as we figured out - this error was always occuring exactly at that time each day.

                      What exactly happens on this virtual server - we are still investigating - but for sure this issue is caused from outside.

                      1 of 1 people found this helpful
                      • 9. Re: javax.ejb.EJBAccessException: Authentication failure with no
                        Neville Camilleri Newbie

                        We are also having the same problem on JBoss 4.2 startup, anyone found a cause for this problem please? This is the stacktrace:

                         

                        Caused by: javax.ejb.EJBAccessException: Authentication failure at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:68)

                                          at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

                                          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:139)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:281)

                                          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)

                                          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)

                                          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:863)

                                          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:634)

                                          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:434)

                                          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:176)

                        Caused by: javax.security.auth.login.FailedLoginException: No matching username found in Principals

                                          at sun.reflect.GeneratedMethodAccessor147.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)

                                          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:563)

                                          at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:506)

                                          at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:331)

                                          at org.jboss.security.plugins.EbetJaasSecurityManager.isValid(EbetJaasSecurityManager.java:203)

                                          at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

                                          at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

                                          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:139)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:281)

                                          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)

                                          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)

                                          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:863)

                                          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:634)

                                          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:434)

                                          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:176)

                                          at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:184)

                                          at org.jboss.remoting.Client.invoke(Client.java:1766)

                                          at org.jboss.remoting.Client.invoke(Client.java:774)

                                          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)

                                          at com.sun.proxy.$Proxy160.getTicketList(Unknown Source)

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

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

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

                                          at com.sun.proxy.$Proxy159.getTicketList(Unknown Source)

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

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

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

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

                                          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)

                                          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

                                          at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)

                                          at com.sun.proxy.$Proxy160.getTicketList(Unknown Source)

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

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

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

                                          at com.sun.proxy.$Proxy159.getTicketList(Unknown Source)

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

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

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

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