glassfish
  1. glassfish
  2. GLASSFISH-6885

Unable to lookup remote JMS Connection Factory from within server

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 9.1peur2
    • Fix Version/s: 4.0
    • Component/s: jms
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

    • Issuezilla Id:
      6,885

      Description

      I am using Glassfish 9.1_02 (build b04-fcs) with 2 servers (domain1 and domain2).

      I have created a JMS Connection Factory on server 1: /jms/myFactory

      When I use the following code from a standalone client, I can lookup the factory
      with no issues.

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
      env.put("org.omg.CORBA.ORBInitialPort", "3700");
      env.put("org.omg.CORBA.ORBInitialHost", "server1");
      env.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
      env.put("java.naming.factory.state",
      "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
      Context ic = new InitialContext(env);
      ConnectionFactory connectionFactory =
      (ConnectionFactory)(ic.lookup("jms/myFactory"));

      However, if I place this code inside an EJB on server2 and try to exercise it, I
      get the following error:

      [#|2008-12-08T14:12:43.768-0700|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=Thread-7;_RequestID=54a6359b-fced-4237-9501-311c7dc551e6;|javax.naming.NameNotFoundException:
      myFactory not found
      at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
      at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
      at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:192)
      at
      com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
      at
      com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
      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.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
      at
      com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
      at
      com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
      at
      com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
      at
      com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)

      This seems to only occur when trying to look up a JMS resource. If I create an
      EJB on server1 I can look it up with no problem using the above code and
      replacing the connection lookup with:

      myEJB ejb = (myEJB)(ic.lookup("myEJB"));

      Is it possible to send/receive JMS messages between servers? If so, how?

      Thanks,

      Joe

        Activity

        Hide
        Simon Meng added a comment -

        After discussing, we think this is a deprecated use case. We will not provide fix for it.

        Show
        Simon Meng added a comment - After discussing, we think this is a deprecated use case. We will not provide fix for it.
        Hide
        Simon Meng added a comment -

        Following is the error message and stacktrace:
        Exception occurred: com.sun.messaging.jms.JMSException: MQRA:DCF:allocation failure:createConnection:No such resource : jms/myConnectionFactory com.sun.messaging.jms.JMSException: MQRA:DCF:allocation failure:createConnection:No such resource : jms/myConnectionFactory at com.sun.messaging.jms.ra.DirectConnectionFactory._allocateConnection(DirectConnectionFactory.java:541) at com.sun.messaging.jms.ra.DirectConnectionFactory.createConnection(DirectConnectionFactory.java:258) at com.sun.messaging.jms.ra.DirectConnectionFactory.createConnection(DirectConnectionFactory.java:237) at servlets.SimpleJmsServlet.processRequest(SimpleJmsServlet.java:71) at servlets.SimpleJmsServlet.doGet(SimpleJmsServlet.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at javax.servlet.http.HttpServlet.service(HttpServlet.java:770) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1593) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:285) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:660) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:600) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:337) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:240) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:172) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:169) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547) at java.lang.Thread.run(Thread.java:679) Caused by: javax.resource.ResourceException: No such resource : jms/myConnectionFactory at com.sun.enterprise.connectors.ConnectionManagerImpl.validateResourceAndPool(ConnectionManagerImpl.java:430) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:160) at com.sun.messaging.jms.ra.DirectConnectionFactory._allocateConnection(DirectConnectionFactory.java:536) ... 31 more

        Show
        Simon Meng added a comment - Following is the error message and stacktrace: Exception occurred: com.sun.messaging.jms.JMSException: MQRA:DCF:allocation failure:createConnection:No such resource : jms/myConnectionFactory com.sun.messaging.jms.JMSException: MQRA:DCF:allocation failure:createConnection:No such resource : jms/myConnectionFactory at com.sun.messaging.jms.ra.DirectConnectionFactory._allocateConnection(DirectConnectionFactory.java:541) at com.sun.messaging.jms.ra.DirectConnectionFactory.createConnection(DirectConnectionFactory.java:258) at com.sun.messaging.jms.ra.DirectConnectionFactory.createConnection(DirectConnectionFactory.java:237) at servlets.SimpleJmsServlet.processRequest(SimpleJmsServlet.java:71) at servlets.SimpleJmsServlet.doGet(SimpleJmsServlet.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at javax.servlet.http.HttpServlet.service(HttpServlet.java:770) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1593) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:285) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:660) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:600) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:337) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:240) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:172) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:169) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547) at java.lang.Thread.run(Thread.java:679) Caused by: javax.resource.ResourceException: No such resource : jms/myConnectionFactory at com.sun.enterprise.connectors.ConnectionManagerImpl.validateResourceAndPool(ConnectionManagerImpl.java:430) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:160) at com.sun.messaging.jms.ra.DirectConnectionFactory._allocateConnection(DirectConnectionFactory.java:536) ... 31 more
        Hide
        Simon Meng added a comment -

        The failed use case include two servers. A server side application program (servlet or ejb) run in server1. The application try to lookup a jms connection factory from a remote server - server2. When it use the lookup returned connection factory to create connection, failure occured. Same code can run successfully in a standalone program.
        The root cause is when lookup the jms connection factory from the remote server, a jms resource adapter will be created in local side. But the jms resource adapter creation check the runtime environment. The jms resource adapter that created in a server runtime is different from that created in the client runtime. The key difference is server side creation check and use the local mq properties.
        I think in the failed use case, when create the jms resource adapter in server1, its environment should be treated as a client runtime.

        Show
        Simon Meng added a comment - The failed use case include two servers. A server side application program (servlet or ejb) run in server1. The application try to lookup a jms connection factory from a remote server - server2. When it use the lookup returned connection factory to create connection, failure occured. Same code can run successfully in a standalone program. The root cause is when lookup the jms connection factory from the remote server, a jms resource adapter will be created in local side. But the jms resource adapter creation check the runtime environment. The jms resource adapter that created in a server runtime is different from that created in the client runtime. The key difference is server side creation check and use the local mq properties. I think in the failed use case, when create the jms resource adapter in server1, its environment should be treated as a client runtime.
        Hide
        Simon Meng added a comment -

        I tried to reproduce the issue. My result is a little different. Lookup JMS connection factory succeed in server side program, but create connect failed. Standalone java program works fine.

        I debugged the source code. In server side program, remote lookup returns DirectConnectionFactory object. In standalone program, remote lookup returns ConnectionFactoryAdapter object. Maybe the jndi lookup operation should return same type in both scenario. Another possible reason is some attributes of DirectConnectionFactory object are set properly.

        Show
        Simon Meng added a comment - I tried to reproduce the issue. My result is a little different. Lookup JMS connection factory succeed in server side program, but create connect failed. Standalone java program works fine. I debugged the source code. In server side program, remote lookup returns DirectConnectionFactory object. In standalone program, remote lookup returns ConnectionFactoryAdapter object. Maybe the jndi lookup operation should return same type in both scenario. Another possible reason is some attributes of DirectConnectionFactory object are set properly.
        Hide
        Tom Mueller added a comment -

        Bulk update to change fix version to "not determined" for all issues still open but with a fix version for a released version.

        Show
        Tom Mueller added a comment - Bulk update to change fix version to "not determined" for all issues still open but with a fix version for a released version.

          People

          • Assignee:
            Simon Meng
            Reporter:
            janchj
          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: