glassfish
  1. glassfish
  2. GLASSFISH-4159

Failed to look up jms resources from other web servers

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.1peur1
    • Fix Version/s: None
    • Component/s: jms
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      4,159

      Description

      When looking up glassfish jms resources from other web servers like tomcat,
      jetty, or resin, got the following exception:

      com.sun.enterprise.connectors.ConnectorRuntimeException: Failed to look up
      ConnectorDescriptor from JNDI
      com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:98)
      javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
      javax.naming.InitialContext.lookup(InitialContext.java:351)
      foo.FooServlet.processRequest(FooServlet.java:56)
      foo.FooServlet.doGet(FooServlet.java:95)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:831)

      All the necessary glassfish jar files have been copied to tomcat:
      appserv-deployment-client.jar
      appserv-admin.jar
      javaee.jar
      zappserv-rt.jar
      appserv-ext.jar
      imqjmsra.jar

      Others have also reported the exactly the same problem on glassfish forum, with
      no solution yet:

      JMS remote client
      http://forums.java.net/jive/thread.jspa?messageID=255213

      JMS lookup problem
      http://forums.java.net/jive/thread.jspa?threadID=36502&tstart=0

        Activity

        Hide
        Jagadish added a comment -
        Show
        Jagadish added a comment - Fixed in v3.1 (trunk) svn log -v -r 35516 https://glassfish-svn.dev.java.net/servlets/ReadMsg?list=commits&msgNo=18049
        Hide
        sanandal added a comment -

        "Reclassifying as P4 because this issue is not deemed "must fix" for this v2.1
        release whose primary release driver is SailFin.
        This issue will be scrubbed after this release and will be given the right
        priority for the next release."

        Show
        sanandal added a comment - "Reclassifying as P4 because this issue is not deemed "must fix" for this v2.1 release whose primary release driver is SailFin. This issue will be scrubbed after this release and will be given the right priority for the next release."
        Hide
        travisb added a comment -
            • Issue 4159 has been confirmed by votes. ***
        Show
        travisb added a comment - Issue 4159 has been confirmed by votes. ***
        Hide
        harpreet added a comment -

        Not critical for v2.1 marking for next release.

        Show
        harpreet added a comment - Not critical for v2.1 marking for next release.
        Hide
        Sivakumar Thyagarajan added a comment -

        Requesting Jagadish to investigate

        Show
        Sivakumar Thyagarajan added a comment - Requesting Jagadish to investigate
        Hide
        Cheng Fang added a comment -

        In ConnectorObjectFactory.getObjectInstance(...), it seems the wrong
        InitialContext is instantiated. Here we always call the no-arg constructor of
        InitialContext(), which will result in the Tomcat naming manager if run inside
        tomcat. We should use the nameCtx param passed in. nameCtx is currently never
        referenced in this method.

        That may also explains why the same code would work in a standalone client
        (where only one naming manager, the default one, is available), but not from a
        foreign web container.

        public class ConnectorObjectFactory implements ObjectFactory {

        public Object getObjectInstance(Object obj,
        Name name,
        Context nameCtx,
        Hashtable env) throws Exception
        {
        Reference ref = (Reference) obj;
        if(_logger.isLoggable(Level.FINE))

        { _logger.log(Level.FINE,"ConnectorObjectFactory: " + ref + " Name:" + name); }

        String poolName = (String) ref.get(0).getContent();
        String moduleName = (String) ref.get(1).getContent();

        Switch sw = Switch.getSwitch();

        if(runtime.getEnviron() == ConnectorRuntime.CLIENT) {
        ConnectorDescriptor connectorDescriptor = null;
        try

        { Context ic = new InitialContext(); String descriptorJNDIName = ConnectorAdminServiceUtils. getReservePrefixedJNDINameForDescriptor(moduleName); connectorDescriptor = (ConnectorDescriptor)ic.lookup(descriptorJNDIName); }

        catch(NamingException ne)

        { _logger.log(Level.FINE, "Failed to look up ConnectorDescriptor from JNDI", moduleName); throw new ConnectorRuntimeException( "Failed to look up ConnectorDescriptor from JNDI"); }
        Show
        Cheng Fang added a comment - In ConnectorObjectFactory.getObjectInstance(...), it seems the wrong InitialContext is instantiated. Here we always call the no-arg constructor of InitialContext(), which will result in the Tomcat naming manager if run inside tomcat. We should use the nameCtx param passed in. nameCtx is currently never referenced in this method. That may also explains why the same code would work in a standalone client (where only one naming manager, the default one, is available), but not from a foreign web container. public class ConnectorObjectFactory implements ObjectFactory { public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env) throws Exception { Reference ref = (Reference) obj; if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE,"ConnectorObjectFactory: " + ref + " Name:" + name); } String poolName = (String) ref.get(0).getContent(); String moduleName = (String) ref.get(1).getContent(); Switch sw = Switch.getSwitch(); if(runtime.getEnviron() == ConnectorRuntime.CLIENT) { ConnectorDescriptor connectorDescriptor = null; try { Context ic = new InitialContext(); String descriptorJNDIName = ConnectorAdminServiceUtils. getReservePrefixedJNDINameForDescriptor(moduleName); connectorDescriptor = (ConnectorDescriptor)ic.lookup(descriptorJNDIName); } catch(NamingException ne) { _logger.log(Level.FINE, "Failed to look up ConnectorDescriptor from JNDI", moduleName); throw new ConnectorRuntimeException( "Failed to look up ConnectorDescriptor from JNDI"); }

          People

          • Assignee:
            Jagadish
            Reporter:
            Cheng Fang
          • Votes:
            4 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: