glassfish
  1. glassfish
  2. GLASSFISH-7302

Glassfish 2.1 doesn't use <message-destination-link> element of MDB deployment descriptor

    Details

    • Issuezilla Id:
      7,302
    • Status Whiteboard:
      Hide

      v3_exclude,V2.1.1exclude

      Show
      v3_exclude,V2.1.1exclude

      Description

      I've been playing a bit with glassfish 2.1 (Sun Java System Application Server
      9.1_02 (build b04-fcs)). I tried to setup a message link scenario between an
      SLSB bean and an MDB bean using a message-destination-link elements of the ejb-
      jar.xml deployment descriptor. The idea is that the MDB consumes messages
      produced by the SLSB bean.

      For the SLSB ejb bean I have the following declaration in ejb-jar.xml:
      <session>
      <ejb-name>TestSLBean</ejb-name>
      <message-destination-ref>
      <message-destination-ref-name>jms/StockQueue</message-destination-ref-name>
      <message-destination-type>javax.jms.Queue</message-destination-type>
      <message-destination-usage>Produces</message-destination-usage>
      <message-destination-link>LogicalStockQueue</message-destination-link>
      </message-destination-ref>
      </session>

      The bean class for this EJB is annotaded with @EJB annotation, so the
      descriptor above only adds the message destinaion ref to its definition. In
      it's code this bean looks up the message destination in its JNDI environment
      and sends a message to it.

      The MDB has the following descriptor:
      <message-driven>
      <ejb-name>TestMDB</ejb-name>
      <ejb-class>com.dembek.testapp.ejb.mdb.TestMDBBean</ejb-class>
      <message-destination-type>javax.jms.Queue</message-destination-type>
      <message-destination-link>LogicalStockQueue</message-destination-link>
      </message-driven>

      The logical destination 'LogicalStockQueue' is then described in the assembly-
      desriptor element of ejb-jar.xml:
      <message-destination>
      <message-destination-name>LogicalStockQueue</message-destination-name>
      </message-destination>

      It is also linked to a phisical destination in sun-ejb-jar.xml:
      <message-destination>
      <message-destination-name>LogicalStockQueue</message-destination-name>
      <jndi-name>PhysicalQueueName</jndi-name>
      </message-destination>

      The 'PhysicalQueueName' queue is defined as a queue in JMS resources part of
      the admin console and linked to a physical destination as well.

      Now to the problem: while deploying this ejb app, I get the following exception:
      com.sun.enterprise.connectors.ConnectorRuntimeException: JMS resource not
      created :
      at
      com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.getPhysicalDestina
      tionFromConfiguration(ActiveJmsResourceAdapter.java:1591)
      at
      com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.updateMDBRuntimeIn
      fo(ActiveJmsResourceAdapter.java:1421)
      at com.sun.enterprise.connectors.inflow.ConnectorMessageBeanClient.setup
      (ConnectorMessageBeanClient.java:170)
      at com.sun.ejb.containers.MessageBeanContainer.<init>
      (MessageBeanContainer.java:209)
      at com.sun.ejb.containers.ContainerFactoryImpl.createContainer
      (ContainerFactoryImpl.java:524)
      at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:527)
      at com.sun.enterprise.server.ApplicationLoader.doLoad
      (ApplicationLoader.java:191)
      at com.sun.enterprise.server.TomcatApplicationLoader.doLoad
      (TomcatApplicationLoader.java:126)
      at com.sun.enterprise.server.ExtendedApplicationLoader.doLoad
      (ExtendedApplicationLoader.java:134)
      at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:238)
      .........
      at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke
      (SunoneInterceptor.java:304)
      at com.sun.enterprise.interceptor.DynamicInterceptor.invoke
      (DynamicInterceptor.java:174)
      at com.sun.enterprise.deployment.client.DeploymentClientUtils.startApplication
      (DeploymentClientUtils.java:159)
      at com.sun.enterprise.deployment.client.DeployAction.run(DeployAction.java:538)
      at java.lang.Thread.run(Thread.java:619)

      I digged a bit into the source code and found out, that Glassfish translates
      the deployment descriptor elements into activation config properties. This
      translation is performed for MDB's using the default resource adapter 'jmsra'
      (which is just the internal JMS implementation exposed as a RA).

      For some reason, the 'Destination' activation config property is created from
      the jndiName of the bean (which happens to be the mappedName property of the
      MessageDriven annotation on the bean class). The message-destination-link
      element is totally ignored:
      From com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.java:
      public void updateMDBRuntimeInfo(EjbMessageBeanDescriptor descriptor_,
      BeanPoolDescriptor poolDescriptor) throws ConnectorRuntimeException{

      String jndiName = descriptor_.getJndiName();

      //handling of MDB 1.3 runtime deployment descriptor
      //if no RA-mid is specified, assume it is a 1.3 DD
      if (jndiName == null) { //something's wrong in DD
      logger.log (Level.SEVERE, "Missing Destination JNDI Name");
      String msg = sm.getString("ajra.error_in_dd");
      throw new RuntimeException(msg);
      }

      String resourceAdapterMid = ConnectorRuntime.DEFAULT_JMS_ADAPTER;

      descriptor_.setResourceAdapterMid(resourceAdapterMid);

      String destName = getPhysicalDestinationFromConfiguration(jndiName);

      //1.3 jndi-name ==> 1.4 setDestination
      descriptor_.putRuntimeActivationConfigProperty(
      new EnvironmentProperty(DESTINATION,
      destName, null));
      ...

      So, instead of the line:

      String jndiName = descriptor_.getJndiName();

      shouldn't we have:

      String jndiName = descriptor_.getMessageDestinationLinkName()

      to read the destination name from the message-destination-link element and in
      case it is not present, fail into any other method (mappedName for instance)?

      I know I can just simply specify an activation config properties for my mdb, or
      use the mappedName property of the MessageDriven annotation to link it to a
      certain queue, but the point is to adhere to the EJB spec and use the message-
      destination-link element of the deployment descriptor.

        Activity

        Hide
        szymondembek added a comment -

        Updated the version number

        Show
        szymondembek added a comment - Updated the version number
        Hide
        doviche added a comment -

        Hello there java guys, I am facing the problem, when I try to deploy my ejb
        module I am getting the same error:
        com.sun.enterprise.connectors.ConnectorRuntimeException: JMS resource not created

        I have previously created my ConnectionFactory in Glassfish under Resources as
        well as the Destination Resource, so I don't see the point why should I be
        getting this error.

        As it seems it fails because at the time of the deployment the container doesn't
        find the Queue Resource I am trying to connect to.

        Any help would be appreciated.

        Thanks to all of you in advance.

        Douglas

        Show
        doviche added a comment - Hello there java guys, I am facing the problem, when I try to deploy my ejb module I am getting the same error: com.sun.enterprise.connectors.ConnectorRuntimeException: JMS resource not created I have previously created my ConnectionFactory in Glassfish under Resources as well as the Destination Resource, so I don't see the point why should I be getting this error. As it seems it fails because at the time of the deployment the container doesn't find the Queue Resource I am trying to connect to. Any help would be appreciated. Thanks to all of you in advance. Douglas
        Hide
        ksak added a comment -

        Marked v3_exclude.

        Show
        ksak added a comment - Marked v3_exclude.
        Hide
        jagadesh added a comment -

        Will not be fixed for V2.1.1

        Show
        jagadesh added a comment - Will not be fixed for V2.1.1
        Hide
        marina vatkina added a comment -

        The error is indicated to be in ActiveJmsResourceAdapter. Requesting Kumar to investigate

        Show
        marina vatkina added a comment - The error is indicated to be in ActiveJmsResourceAdapter. Requesting Kumar to investigate
        Hide
        Cheng Fang added a comment -

        This is the same issue as http://java.net/jira/browse/GLASSFISH-8605. Also, Sun bug 6335445 has more details and evaluation.

        Show
        Cheng Fang added a comment - This is the same issue as http://java.net/jira/browse/GLASSFISH-8605 . Also, Sun bug 6335445 has more details and evaluation.
        Hide
        David Zhao added a comment -

        Fixed it in trunk branch by checkin 52556.

        Show
        David Zhao added a comment - Fixed it in trunk branch by checkin 52556.
        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:
            David Zhao
            Reporter:
            szymondembek
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: