users@glassfish.java.net

NameNotFoundException occurs randomly while doing EJB lookup using JNDI

From: <glassfish_at_javadesktop.org>
Date: Tue, 30 Dec 2008 21:47:06 PST

Hi,

I've an MDB that uses the command pattern. The command class throws a 'NameNotFoundException' while looking up home interfaces using JNDI. This doesn't happen always. It happens only in 50% of the the time. I've the <ejb-local-ref> tags defined for the MDB in ejb-jar.xml for the EJBs it is using. We are using EJB 2.X and glassfish v2 ur2.

Here is the stack trace:

[#|2008-12-30T23:34:12.851-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=17;_ThreadName=p: thread-pool-1; w: 17;|23:34:12,851 ERROR awardslinq.EJBLookup | alqadmin | - Error accessing CatalogLocalHome from ServiceLocator by service name: Catalog
javax.naming.NameNotFoundException: No object bound to name java:comp/env/Catalog
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:834)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.biperf.util.servicelocator.ServiceLocator.lookupEnv(ServiceLocator.java:269)
        at com.biperf.services.awardslinqservices.util.EJBLookup.lookupEnv(EJBLookup.java:881)
        at com.biperf.services.awardslinqservices.util.EJBLookup.getCatalogLocalHome(EJBLookup.java:303)
        at com.biperf.services.awardslinqservices.ejb.session.catalog.command.ProductGroupModeler.modelProductGroups(ProductGroupModeler.java:110)
        at com.biperf.services.awardslinqservices.ejb.mdb.command.AsyncProductGroupModeler.run(AsyncProductGroupModeler.java:57)
        at com.biperf.ejb.AsyncProcessorBean.onMessage(AsyncProcessorBean.java:121)
        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 com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:182)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:1041)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:187)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
        at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:1111)
        at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:74)
        at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:179)
        at $Proxy346.onMessage(Unknown Source)
        at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:258)
        at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)

Thanks
Suneel
[Message sent by forum member 'suneelgv' (suneelgv)]

http://forums.java.net/jive/thread.jspa?messageID=323677