glassfish
  1. glassfish
  2. GLASSFISH-1480

Can not lookup a JMS topic using sub-context

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 9.0pe
    • Fix Version/s: 9.1pe
    • Component/s: jms
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1,480

      Description

      Having sucessfully created two topics in the web admin with name :
      "jms/supernotification" and "notification".

      With a code like :
      Properties properties = new Properties();
      properties.setProperty(Context.PROVIDER_URL,"iiop://127.0.0.1:3700");
      properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory");
      InitialContext context = new InitialContext(properties);
      TopicConnectionFactory connectionFactory =
      (TopicConnectionFactory)context.lookup("jms/JabberConnection");
      Topic topic = (Topic)context.lookup(NAME);
      TopicSession session =
      connectionFactory.createTopicConnection().createTopicSession(false,Session.AUTO_ACKNOWLEDGE);

      With NAME like "notification", we are successfully connecting.

      With NAME like "jms/supernotification", it will fail with :
      ...
      Caused by: com.sun.enterprise.resource.PoolingException
      at
      com.sun.enterprise.connectors.AdministeredObjectResource.createAdministeredObject(AdministeredObjectResource.java:161)
      at
      com.sun.enterprise.naming.factory.AdministeredObjectFactory.getObjectInstance(AdministeredObjectFactory.java:101)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
      ... 29 more
      Caused by: java.security.PrivilegedActionException:
      com.sun.enterprise.connectors.ConnectorRuntimeException
      at java.security.AccessController.doPrivileged(Native Method)
      at
      com.sun.enterprise.connectors.AdministeredObjectResource.createAdministeredObject(AdministeredObjectResource.java:157)
      ... 32 more
      Caused by: com.sun.enterprise.connectors.ConnectorRuntimeException
      at
      com.sun.enterprise.connectors.util.SetMethodAction.handleException(SetMethodAction.java:129)
      at
      com.sun.enterprise.connectors.util.SetMethodAction.run(SetMethodAction.java:115)
      ... 34 more
      Caused by: java.lang.reflect.InvocationTargetException
      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:589)
      at
      com.sun.enterprise.connectors.util.SetMethodAction.run(SetMethodAction.java:88)
      ... 34 more
      Caused by: java.lang.IllegalArgumentException: MQ:Topic:Invalid Topic Name -
      jms/supernotification
      at com.sun.messaging.Topic.setName(Topic.java:64)
      ... 39 more

      I see no limitation in Java EE 5 (+JMS) specs about usage of relative name with
      sub-context.

      At this time, it try to resolve with a name like jms/supernotification in the
      root context (hence, Destinationname.isSyntaxValid() is blocking this, because /
      is not a valid char here) but it should have resolved jms has subcontext and
      then resolved supernotification in this subcontext !

        Activity

        Hide
        Sivakumar Thyagarajan added a comment -

        Could you please share your domain.xml snippet for "jms/supernotification"? What
        is the value of the "Name" property of that admin object [destination resource]?

        Show
        Sivakumar Thyagarajan added a comment - Could you please share your domain.xml snippet for "jms/supernotification"? What is the value of the "Name" property of that admin object [destination resource] ?
        Hide
        bjb added a comment -

        Hi Sivakumar,

        You just guessed it right

        The web console had generated to me :
        <admin-object-resource enabled="true" jndi-name="jms/JabberNotification"
        object-type="user" res-adapter="jmsra" res-type="javax.jms.Topic">
        <description>Notify presence</description>
        <property name="Name" value="jms/JabberNotification"/>
        <property name="Description" value="Notify presence"/>
        </admin-object-resource>

        This means, web console made "jms/JabberNotification" a valid name. It should
        not have allowed me as per the current implementation, because I will 100% get
        the exception when connecting to the resource !

        Changing Name from jms/JabberNotification to JabberNotification and I am able to
        connect to context jms/JabberNotification

        Two solutions :

        • remove the restriction on topic name (dont know why there is a restriction here)
        • align web console ( and console ?) to the same checkings as the connection

        Rgs,
        JB

        Show
        bjb added a comment - Hi Sivakumar, You just guessed it right The web console had generated to me : <admin-object-resource enabled="true" jndi-name="jms/JabberNotification" object-type="user" res-adapter="jmsra" res-type="javax.jms.Topic"> <description>Notify presence</description> <property name="Name" value="jms/JabberNotification"/> <property name="Description" value="Notify presence"/> </admin-object-resource> This means, web console made "jms/JabberNotification" a valid name. It should not have allowed me as per the current implementation, because I will 100% get the exception when connecting to the resource ! Changing Name from jms/JabberNotification to JabberNotification and I am able to connect to context jms/JabberNotification Two solutions : remove the restriction on topic name (dont know why there is a restriction here) align web console ( and console ?) to the same checkings as the connection Rgs, JB
        Hide
        Sivakumar Thyagarajan added a comment -

        So, that explains it.

        > Two solutions :
        > - remove the restriction on topic name (dont know why there is a restriction here)
        This check for the destination name is done by MQ. MQ has a restriction on
        destination names not having a "/". I don't think we could request MQ to change
        their naming restrictions
        > - align web console ( and console ?) to the same checkings as the connection
        For better usability, on the other hand, GlassFish appserver could eagerly check
        for such errors and fail destination resource creation in this case with an
        error message indicating that "Name" should be a valid MQ destination "Name".

        We shall consider this issue post GFv2 MS3, if that is okay. Thanks for raising
        this issue.

        Show
        Sivakumar Thyagarajan added a comment - So, that explains it. > Two solutions : > - remove the restriction on topic name (dont know why there is a restriction here) This check for the destination name is done by MQ. MQ has a restriction on destination names not having a "/". I don't think we could request MQ to change their naming restrictions > - align web console ( and console ?) to the same checkings as the connection For better usability, on the other hand, GlassFish appserver could eagerly check for such errors and fail destination resource creation in this case with an error message indicating that "Name" should be a valid MQ destination "Name". We shall consider this issue post GFv2 MS3, if that is okay. Thanks for raising this issue.
        Hide
        bjb added a comment -

        >> Two solutions :
        >> - remove the restriction on topic name (dont know why there is a restriction
        here)
        >This check for the destination name is done by MQ. MQ has a restriction on
        destination names not having a "/". I don't think we could request MQ to change
        their naming restrictions

        No problem, although issue 1369 has requested for instance some change here.

        >> - align web console ( and console ?) to the same checkings as the connection
        >For better usability, on the other hand, GlassFish appserver could eagerly
        check for such errors and fail destination resource creation in this case with
        an error message indicating that Name" should be a valid MQ destination "Name".

        Exactly, having clearer exception and error message will help developper to
        setup the environment. Will save people time, will improve usability.

        >We shall consider this issue post GFv2 MS3, if that is okay. Thanks for raising
        this issue.

        Great ! Having this one will definitively ease JMS usage inside GF.

        Best Rgs,
        JB

        Show
        bjb added a comment - >> Two solutions : >> - remove the restriction on topic name (dont know why there is a restriction here) >This check for the destination name is done by MQ. MQ has a restriction on destination names not having a "/". I don't think we could request MQ to change their naming restrictions No problem, although issue 1369 has requested for instance some change here. >> - align web console ( and console ?) to the same checkings as the connection >For better usability, on the other hand, GlassFish appserver could eagerly check for such errors and fail destination resource creation in this case with an error message indicating that Name" should be a valid MQ destination "Name". Exactly, having clearer exception and error message will help developper to setup the environment. Will save people time, will improve usability. >We shall consider this issue post GFv2 MS3, if that is okay. Thanks for raising this issue. Great ! Having this one will definitively ease JMS usage inside GF. Best Rgs, JB
        Hide
        Sivakumar Thyagarajan added a comment -

        Ramesh, could you handle this as part of our other chnages

        Show
        Sivakumar Thyagarajan added a comment - Ramesh, could you handle this as part of our other chnages
        Hide
        rampsarathy added a comment -

        This has been fixed by validating the destination name when the jms resource is
        being created. Fix should be available in 9.1 build 28.

        Show
        rampsarathy added a comment - This has been fixed by validating the destination name when the jms resource is being created. Fix should be available in 9.1 build 28.
        Hide
        Alexis MP added a comment -

        bjb, have you had a chance to check this with recent builds?
        Build 33 was released today.
        thanks,

        Show
        Alexis MP added a comment - bjb, have you had a chance to check this with recent builds? Build 33 was released today. thanks,

          People

          • Assignee:
            rampsarathy
            Reporter:
            bjb
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: