2 Replies Latest reply on Nov 20, 2012 9:01 PM by raylite3

    How do I specify rar for MDB in jboss-ejb3.xml?

    raylite3 Apprentice

      Hello,

      I am trying to migrate and use the jca-sockets project (http://code.google.com/p/jca-sockets/) in JBoss7. It uses jboss.xml like below. How do I migrate this to jboss-ejb3.xml? The schema does not allow me to specify the resource-adapter-name as below. I get a "Unexpected element '{http://java.sun.com/xml/ns/javaee}resource-adapter-name' encountered" message.

       

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss>
              <enterprise-beans>
                      <message-driven>
                              <ejb-name>SOCKET_MDB</ejb-name>
                      <!-- Need to specify the file extension .rar  -->
                              <resource-adapter-name>sockets-rar-${project.version}.rar</resource-adapter-name>
                      </message-driven>
              <message-driven>
                  <ejb-name>SOCKET_MDB1</ejb-name>
                      <!-- Need to specify the file extension .rar  -->
                  <resource-adapter-name>sockets-rar-${project.version}.rar</resource-adapter-name>
              </message-driven>
              </enterprise-beans>
      </jboss>
        • 1. Re: How do I specify rar for MDB in jboss-ejb3.xml?
          Heinz Wilming Newbie

          Hi,


          the name of the resource adapter can be configured as follows in the jboss-ejb3.xml descriptor:

           

           

          <?xml version="1.0" encoding="UTF-8"?>
          <jboss xmlns="http://www.jboss.com/xml/ns/javaee" 
              xmlns:jee="http://java.sun.com/xml/ns/javaee"
              xmlns:mdb="urn:resource-adapter-binding"
              xmlns:security="urn:security">
          
              <jee:assembly-descriptor>
                  <mdb:resource-adapter-binding>
                      <jee:ejb-name>SOCKET_MDB</jee:ejb-name>
                      <mdb:resource-adapter-name>sockets-rar-${project.version}.rar</mdb:resource-adapter-name>
                  </mdb:resource-adapter-binding>
              </jee:assembly-descriptor>
          </jboss>
          

           

          Alternatively, you can also configure the name of the resource adapter by the following annotation (but without property substitution):

           

           

          @MessageDriven(name = "ExampleQueueMDB", activationConfig = {
                    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
                    @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/test") })
          
          @org.jboss.ejb3.annotation.ResourceAdapter("name-ra.rar")
          public class ExampleQueueMDB implements MessageListener {
          
               @Override
               public void onMessage(Message message) { ... }
          }
          
          

           

          Regards, Heinz