users@glassfish.java.net

JMS lookup problem

From: <glassfish_at_javadesktop.org>
Date: Sat, 09 Feb 2008 08:29:46 PST

Can please someone help me how to look up JMS QueueConnectionFactory object by JNDI. Which JNDI context provider to use? I am trying to get QueueConnectionFactory by web app deployed on Tomcan from Glassfish v2.
My code for looking up is:


Properties props = new Properties();
            props.setProperty("java.naming.factory.initial",
                    "com.sun.enterprise.naming.SerialInitContextFactory");
            props.setProperty("java.naming.factory.url.pkgs",
                    "com.sun.enterprise.naming:com.sun.enterprise.naming:com.sun.enterprise.naming");
            props.setProperty("java.naming.factory.state",
                    "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");

            // optional. Defaults to localhost. Only needed if web server is running
            // on a different host than the appserver
            // props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");



            InitialContext context = new InitialContext(props);
            System.out.println(context.getEnvironment());
            connectionFactory = (QueueConnectionFactory) context.lookup("webTrackerConnFactory");




and it generates following exception:


Feb 9, 2008 7:35:52 PM com.sun.enterprise.naming.SerialContext lookup
SEVERE: NAM0004: Exception during name lookup : {0}
com.sun.enterprise.connectors.ConnectorRuntimeException: Failed to look up ConnectorDescriptor from JNDI
        at com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:98)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:344)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at jmsclasses.JMSResourceAlocator.initConnFactory(JMSResourceAlocator.java:45)
        at jmsclasses.JMSResourceAlocator.createQueueConnection(JMSResourceAlocator.java:55)
        at jmsclasses.JMSMessageSender.sendMessage(JMSMessageSender.java:23)
        at org.apache.jsp.personInput_jsp._jspService(personInput_jsp.java from :75)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
[Message sent by forum member 'chiagng' (chiagng)]

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