8 Replies Latest reply on May 6, 2014 6:13 AM by Wolfgang Knauf

    "@JMSDestinationDefinition" and JavaEE application client

    Wolfgang Knauf Master

      Hi,

       

      I started experimenting with a few JMS 2.0 features, e.g. the "@JMSDestinationDefinition" annotation, which is placed on a Message Driven Bean in my sample.

       

      I want to access the MDB with a JavaEE application client. But injection of the queue does not work. It is either null (if injected directly), or when using an ENC reference, WildFly tells me that it cannot resolve this binding.

       

      Attached is my sample EAR file, and also my "appclient.xml". No changed to "standalone-full.xml"

       

      To reproduce the problem:

      a) start WildFly using "standalone-full.xml"

      b) deploy attached file "Message.ear"

      c) replace "%WILDFLY_HOME%\appclient\application.xml"  with attached file

      d) start client using "%WILDFLY_HOME%\bin\appclient.bat  c:\path\to\Message.ear#MessageClient.jar"

       

      Relevant snippets of my config (for the case "JNDI lookup for ENC binding"):

      MDB:

      @MessageDriven (activationConfig=

        {

          @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),

          @ActivationConfigProperty(propertyName="destination", propertyValue="/jms/queue/MessageBeanQueue")

        })

      @JMSDestinationDefinition(

          name = "java:/jms/queue/MessageBeanQueue",

          interfaceName = "javax.jms.Queue",

          destinationName = "MessageBeanQueue"

        )

      public class MessageBean implements MessageListener

      {

       

      In the application client: definition of JNDI binding for my queue in "jboss-client.xml":

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-client xmlns="http://www.jboss.com/xml/ns/javaee"

          xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:xml="http://www.w3.org/XML/1998/namespace"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-client_6_0.xsd"

          version="6.0">

          ....

          <resource-ref>

              <res-ref-name>jms/MBQueueRef</res-ref-name>

              <jndi-name>java:/jms/queue/MessageBeanQueue</jndi-name>

          </resource-ref>

      </jboss-client>

       

      My "application-client.xml":

      <?xml version="1.0" encoding="UTF-8"?>

      <application-client xmlns="http://xmlns.jcp.org/xml/ns/javaee"

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee

                http://xmlns.jcp.org/xml/ns/javaee/application-client_7.xsd"

            version="7">

         ...

         <resource-ref >

            <res-ref-name>jms/MBQueueRef</res-ref-name>

            <res-type>javax.jms.Queue</res-type>

            <res-auth>Container</res-auth>

         </resource-ref>

      </application-client>

       

      Part of my client code:

         InitialContext initialContext = new InitialContext();

         QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) initialContext.lookup("java:comp/env/jms/MBConnectionFactory");

         

         Queue queue = (Queue) initialContext.lookup("java:comp/env/jms/MBQueueRef");

       

      Does someone see whether this is an error of mine or whether this is a missing feature in WildFly 8?

       

      Best regards

       

      Wolfgang