Reputation: 1360
I'm using JEE6 with Glassfish 3.1 and Eclipse helios. I've been running several EJB's, servlets, and JPA with a database. Now I just tried to create another EJB @Statless and @LocalBean. When I inject this bean into another bean so that I can call it from there I get deployment errors.
[#|2011-12-27T19:15:14.703-0700|SEVERE|glassfish3.1.1|javax.enterprise.system.tools.ad min.org.glassfish.deployment.admin|_ThreadID=19;_ThreadName=Thread-2;|
Exception while loading the app : javax.ejb.CreateException: Initialization failed for Singleton Driver
javax.ejb.CreateException: Initialization failed for Singleton Driver
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:547)
at com.sun.ejb.containers.AbstractSingletonContainer.access$100(AbstractSingletonContainer.java:79)
And
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:376)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:538)
... 38 more
Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:726)
at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:247)
at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:449)
... 63 more
Caused by: javax.ejb.CreateException: Could not create stateless EJB
at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:534)
at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:95)
And finally:
Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=com.logic.bean/tclient,Remote 3.x interface =com.thrift.ThriftClient,ejb-link=null,lookup=,mappedName=,jndi-name=com.thrift.ThriftClient,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'com.thrift.ThriftClient#com.thrift.ThriftClient' [Root exception is javax.naming.NamingException: Lookup failed for 'com.thrift.ThriftClient#com.thrift.ThriftClient' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: com.thrift.ThriftClient#com.thrift.ThriftClient not found]]
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:178)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1106)
This is the new EJB code:
...imports...
@Stateless
@LocalBean
public class ThriftClient {
public ThriftClient(){}
...other code....
and how I inject it:
@EJB ThriftClient tclient;
I'm injecting it into another stateless bean that has other EJB injections that work.
Upvotes: 1
Views: 3486
Reputation: 700
Check in Glassfish console if the bean deployed correctly and under what JNDI name. I know that it should work out of the box, but maybe it's worth playing with @EJB annotation parameters to make it point to right JNDI name. This can help you finding the real problem as it is clearly related to JNDI naming. You may also try to find the bean through explicit JNDI lookup instead of injecting it and maybe you'll notice the problem then.
Upvotes: 1