users@glassfish.java.net

JMS client cannot locate message driven bean

From: <glassfish_at_javadesktop.org>
Date: Sun, 10 Jun 2007 17:20:13 PDT

This is very strange, shouldn't generated code simply work? Using NetBeans 5.5 and Sun App Server 9.0_01 (build b14):

The NetBeans generated code for accessing a Message Driven Bean fails, although the JMS resources seem to be configured properly at the app server. If I comment out the @Resource annotations, the app runs fine. This is what I did:

I created a Message Driven Beans and in a SFSB I right clicked and selected "Enterprise Resources->Send JMS Message".

NetBeans adds the appropriate code but it doesn't work. Essentially the injections fail. I verified the resources are defined in Sun App Server using the admin console. The app server defines a Connection Factory called "jms/OrderMessageFactory" and a Destination Resource called "jms/OrderMessage". The application will not deploy because the @Resource injection fails. The error is:

[#|2007-06-10T18:14:42.303-0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.core.naming|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;jms/OrderMessage;java:comp/env/Books.CartBean/orderMessage;_RequestID=9c254d34-1593-425f-956a-95e48af5274b;|NAM0008 : Invalid Destination: jms/OrderMessage for java:comp/env/Books.CartBean/orderMessage|#]

The full stack trace is at the end of this email.

The generated annotations are these. If I comment these out, the app deploys and runs:

   @Resource(mappedName = "jms/OrderMessageFactory")
   private ConnectionFactory orderMessageFactory;

   @Resource(mappedName = "jms/OrderMessage")
   private javax.jms.Queue orderMessage;


The MDB is basically generated code. I only added the logger code:

@MessageDriven(mappedName = "jms/OrderMessage", activationConfig = {
       @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
       @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
   })
public class OrderMessage implements MessageListener {
   static final Logger logger = Logger.getLogger("MessageBean");
   /** Creates a new instance of OrderMessage */
   public OrderMessage() {
   }

   public void onMessage(Message message) {
       logger.info("onMessage: \n" + message.toString());
   }
}

[#|2007-06-10T18:14:42.303-0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.core.naming|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;jms/OrderMessage;java:comp/env/Books.CartBean/orderMessage;_RequestID=9c254d34-1593-425f-956a-95e48af5274b;|NAM0008 : Invalid Destination: jms/OrderMessage for java:comp/env/Books.CartBean/orderMessage|#]

[#|2007-06-10T18:14:42.303-0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException];_RequestID=9c254d34-1593-425f-956a-95e48af5274b;|EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]|#]

[#|2007-06-10T18:14:42.303-0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;_RequestID=9c254d34-1593-425f-956a-95e48af5274b;|appId=TS5529 moduleName=TS5529-ejb_jar ejbName=CartBean|#]

[#|2007-06-10T18:14:42.303-0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.core.classloading|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;_RequestID=9c254d34-1593-425f-956a-95e48af5274b;|LDR5004: UnExpected error occured while creating ejb container
javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]
   at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:485)
   at com.sun.ejb.containers.BaseContainer.setupEnvironment(BaseContainer.java:2628)
   at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:629)
   at com.sun.ejb.containers.StatefulSessionContainer.<init>(StatefulSessionContainer.java:339)
   at com.sun.ejb.containers.builder.StatefulContainerBuilder.createContainer(StatefulContainerBuilder.java:107)
   at com.sun.ejb.containers.builder.BaseContainerBuilder.buildContainer(BaseContainerBuilder.java:86)
   at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:525)
   at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:490)
   at com.sun.enterprise.server.ApplicationLoader.load(ApplicationLoader.java:184)
   at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:113)
   at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:322)
   at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:216)
   at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:189)
   at com.sun.enterprise.server.ApplicationManager.applicationEnabled(ApplicationManager.java:754)
   at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:914)
   at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:892)
   at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:445)
   at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
   at com.sun.enterprise.admin.server.core.AdminNotificationHelper.sendNotification(AdminNotificationHelper.java:128)
   at com.sun.enterprise.admin.server.core.ConfigInterceptor.postInvoke(ConfigInterceptor.java:109)
   at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:97)
   at $Proxy1.invoke(Unknown Source)
   at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
   at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:56)
   at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:142)
   at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:109)
   at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:180)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
   at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
   at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
   at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
   at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
   at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
   at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
   at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
   at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
   at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
   at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
   at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
   at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
   at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
   at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
   at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
   at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: javax.naming.NameNotFoundException
   at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:255)
   at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:178)
   at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
   at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:98)
   at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
   at javax.naming.InitialContext.lookup(InitialContext.java:392)
   at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:469)
   ... 52 more
|#]

[#|2007-06-10T18:14:42.334-0400|WARNING|sun-appserver-pe9.0|javax.enterprise.system.core|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;TS5529;_RequestID=9c254d34-1593-425f-956a-95e48af5274b;|CORE5021: Application NOT loaded: [TS5529]|#]
[Message sent by forum member 'orbach' (orbach)]

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