javax.ejb.EJBAccessException: Authentication failure with no
ericchile Nov 28, 2006 5:46 PMI 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