users@glassfish.java.net

Help with MDB deployment descriptor

From: <guru_gho_at_hotmail.com>
Date: Wed, 26 Oct 2011 18:01:54 +0000 (GMT)

I am searching for the best way to write the deployment descriptor file
for a MDB Bean.

I saw examples instructing to write as mapped-name the JNDI name the
MDB will consume.
So, it may be used:

        <message-driven>
            <ejb-name>ServiceActivator</ejb-name>
            <mapped-name>jms/myQueue</mapped-name
        </message-driven>


However, it may cause confusion to unexperienced deployers that does
not understand too well JMS technology.

So, I tried an alternative approach where we can explicitly specify the
message destination JNDI:

        <message-driven>
            <ejb-name>ServiceActivator</ejb-name>
            <!-- <mapped-name>jms/myQueue</mapped-name> -->

            <activation-config>
                <!-- For JMS message-driven beans,
                    the following property names are recognized:
                    acknowledgeMode, messageSelector, destinationType,
subscriptionDurability
                 -->
                <activation-config-property>
                   
<activation-config-property-name>destinationType</activation-config-pro
perty-name>
                   
<activation-config-property-value>javax.jms.Queue</activation-config-pr
operty-value>
                </activation-config-property>
            </activation-config>
           
            <message-destination-ref>
                <!-- <description>Reference to the Queue consumed by
the MDB</description> -->
                <!-- The message-destination-ref-name element specifies
the name of a message destination reference;
                    its value is the message destination reference name
used in the component code.
                    The name is a JNDI name relative to the
java:comp/env context and must be unique within an component.
                 -->
               
<message-destination-ref-name>jms/myQueue</message-destination-ref-name
>
               
<message-destination-type>javax.jms.Queue</message-destination-type>
               
<message-destination-usage>Consumes</message-destination-usage>
            </message-destination-ref>
        </message-driven>


But this alternative do not work and fail with the following message:

[#|2011-10-21T15:31:21.844-0200|SEVERE|glassfish3.1.1|javax.enterprise.
system.container.ejb.mdb.com.sun.ejb.containers|_ThreadID=22;_ThreadNam
e=Thread-2;|MDB00017: [ServiceActivator]: Exception in creating
message-driven bean container:
[com.sun.appserv.connectors.internal.api.ConnectorRuntimeException:
Error in Runtime DD: missing destination JNDI name]|#]

[#|2011-10-21T15:31:21.846-0200|SEVERE|glassfish3.1.1|javax.enterprise.
system.container.ejb.mdb.com.sun.ejb.containers|_ThreadID=22;_ThreadNam
e=Thread-2;|com.sun.appserv.connectors.internal.api.ConnectorRuntimeExc
eption
com.sun.appserv.connectors.internal.api.ConnectorRuntimeException:
Error in Runtime DD: missing destination JNDI name

Is it a Glassfish bug?
If not, what is the correct way to explicitly set the JNDI destination
name? I think using activation config destinationName property may not
work nor be EJB 3.1 spec compliant.

NOTE: My examples were based on section 16.9.2 from the EJB 3.1 spec. I
couldn't find how my example differs from the example stated in specs.

Best regards,
Orair.