7 Replies Latest reply on Jan 13, 2013 4:36 PM by max010

    Migrate JMS from JBoss5 to JBoss7

    max010

      I am trying to migrate from JBoss5 to JBoss7.  In the server.log I get the following error:

       

      15:40:47,006 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

      JBAS014775:    New missing/unsatisfied dependencies:

            service jboss.naming.context.java.module.myapp-web.myapp-web.env.topic.ImportStartTopic (missing) dependents: [service jboss.naming.context.java.module.myapp-web.myapp-web.env.jms.ImportStartTopic]

       

      15:40:47,007 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS014654: Composite operation was rolled back

      15:40:47,008 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.myapp-web.myapp-web.env.jms.ImportStartTopicjboss.naming.context.java.module.myapp-web.myapp-web.env.topic.ImportStartTopicMissing[jboss.naming.context.java.module.myapp-web.myapp-web.env.jms.ImportStartTopicjboss.naming.context.java.module.myapp-web.myapp-web.env.topic.ImportStartTopic]"]}}}

       

       

      I have a .war to deploy with a web.xml in the WEB-INF directory.  Inside the web.xml I have the following jms config:

       

      <resource-env-ref>

                          <resource-env-ref-name>jms/ImportStartTopic</resource-env-ref-name>

                          <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>

      </resource-env-ref>

       

      The JBoss5 destinations-service.xml contains:

       

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

       

      <server>          

       

                <mbean code="org.jboss.mq.server.jmx.Queue" name="jboss.mq.destination:service=Queue,name=ImporterQueue">

                          <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>

                </mbean>

       

                <mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.mq.destination:service=Topic,name=ImportStartTopic">

                          <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>

                </mbean>

      </server>

       

      In the ejb.jar in a java class I have a static reference:

       

      public static final String IMPORT_START_TOPIC = "topic/ImportStartTopic";

       

      that is used to lookup the TopicConnectionFactory:

       

      InitialContext ic = new InitialContext();

      TopicConnectionFactory topicConnectionFactory = ( TopicConnectionFactory ) ic.lookup( JNDINames.TOPIC_CONNECTION_FACTORY );

      Topic importStartTopic = ( Topic ) ic.lookup( JNDINames.IMPORT_START_TOPIC );

       

      I am trying to follow the instructions on how to migrate from https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7. I am focusing on the section "Migrate from JBoss Messaging to HornetQ".

       

      The JBoss5 connection-factories-service.xml has the following JMS connection factories:

       

      <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"

            name="jboss.messaging.connectionfactory:service=ConnectionFactory"

            xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">

            <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>

            <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>

            <depends>jboss.messaging:service=PostOffice</depends>

           

            <attribute name="JNDIBindings">

               <bindings>

                  <binding>/ConnectionFactory</binding>

                  <binding>/XAConnectionFactory</binding>

                  <binding>java:/ConnectionFactory</binding>

                  <binding>java:/XAConnectionFactory</binding>

               </bindings>

            </attribute>

         </mbean>

       

      <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"

            name="jboss.messaging.connectionfactory:service=ClusteredConnectionFactory"

            xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">

            <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>

            <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>

            <depends>jboss.messaging:service=PostOffice</depends>

       

       

            <attribute name="JNDIBindings">

               <bindings>

                  <binding>/ClusteredConnectionFactory</binding>

                  <binding>/ClusteredXAConnectionFactory</binding>

                  <binding>java:/ClusteredConnectionFactory</binding>

                  <binding>java:/ClusteredXAConnectionFactory</binding>

               </bindings>

            </attribute>

       

       

            <attribute name="SupportsFailover">true</attribute>

            <attribute name="SupportsLoadBalancing">true</attribute>     

         </mbean>

       

      <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"

            name="jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory"

            xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">

            <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>

            <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>

            <depends>jboss.messaging:service=PostOffice</depends>

            <attribute name="SupportsFailover">false</attribute>

            <attribute name="SupportsLoadBalancing">false</attribute>     

         </mbean>

       

       

      I have tried to migrate the JMS configurations to HornetQ but I am guessing I am doing something wrong.  The standalone.xml section for JMS has the following config:

       

      <subsystem xmlns="urn:jboss:domain:messaging:1.1">

                  <hornetq-server>

                      <persistence-enabled>true</persistence-enabled>

                      <journal-file-size>102400</journal-file-size>

                      <journal-min-files>2</journal-min-files>

                      <connectors>

                          <netty-connector name="netty" socket-binding="messaging"/>

                          <netty-connector name="netty-throughput" socket-binding="messaging-throughput">

                              <param key="batch-delay" value="50"/>

                          </netty-connector>

                          <in-vm-connector name="in-vm" server-id="0"/>

                      </connectors>

                      <acceptors>

                          <netty-acceptor name="netty" socket-binding="messaging"/>

                          <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">

                              <param key="batch-delay" value="50"/>

                              <param key="direct-deliver" value="false"/>

                          </netty-acceptor>

                          <in-vm-acceptor name="in-vm" server-id="0"/>

                      </acceptors>

                      <security-settings>

                          <security-setting match="#">

                              <permission type="send" roles="guest"/>

                              <permission type="consume" roles="guest"/>

                              <permission type="createNonDurableQueue" roles="guest"/>

                              <permission type="deleteNonDurableQueue" roles="guest"/>

                          </security-setting>

                      </security-settings>

                      <address-settings>

                          <!--default for catch all-->

                          <address-setting match="#">

                              <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                              <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                              <redelivery-delay>0</redelivery-delay>

                              <max-size-bytes>10485760</max-size-bytes>

                              <address-full-policy>BLOCK</address-full-policy>

                              <message-counter-history-day-limit>10</message-counter-history-day-limit>

                          </address-setting>

                      </address-settings>

                      <jms-connection-factories>

                          <connection-factory name="InVmConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/ConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <connection-factory name="RemoteConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="netty"/>

                              </connectors>

                              <entries>

                                  <entry name="RemoteConnectionFactory"/>

                                  <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <pooled-connection-factory name="hornetq-ra">

                              <transaction mode="xa"/>

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/JmsXA"/>

                              </entries>

                          </pooled-connection-factory>

                      </jms-connection-factories>

                      <jms-destinations>

                          <jms-queue name="ImporterQueue">

                              <entry name="queue/ImporterQueue"/>

                              <entry name="java:jboss/exported/jms/queue/ImporterQueue"/>

                          </jms-queue>

                          <jms-topic name="ImportStartTopic">

                              <entry name="topic/ImportStartTopic"/>

                              <entry name="java:jboss/exported/jms/topic/ImportStartTopic"/>

                          </jms-topic>

                      </jms-destinations>

                  </hornetq-server>

              </subsystem>

       

      In the .war WEB-INF directory I also have a jboss-deployment-structure.xml with the following additional module dependencies:

       

      <dependencies>

            <module name="javax.activation.api"/>

            <module name="javax.ejb.api"/>

            <module name="javax.jms.api"/>

            <module name="javax.mail.api"/>

            <module name="javax.servlet.api"/>

            <module name="javax.servlet.jsp.api"/>

            <module name="org.dom4j"/>

            <module name="org.jboss.logging"/>

            <module name="com.myapp.ejb" />

      </dependencies>

       

      I am reading JMS and HornetQ documentation to see if I can understand what is going wrong.  Can anyone help me with this issue?

      If you need more info let me know.

       

      Thanks,

       

      Max

        • 1. Re: Migrate JMS from JBoss5 to JBoss7
          nickarls

          I suggest you run some hornetq quickstart examples on the AS first so you can play around with the settings and then apply the knowledge to the main application.

          1 of 1 people found this helpful
          • 2. Re: Migrate JMS from JBoss5 to JBoss7
            max010

            Thanks Nicklas I will give it a try.

            • 3. Re: Migrate JMS from JBoss5 to JBoss7
              jbertram

              It's been awhile since I've deployed an app like this, but isn't every <resource-env-ref> supposed to map to a matching entry in the vendor's deployment descriptor where it is paired with the actual JNDI name of the resource?  I don't see a reference to anything like that in your comment so my guess is that's your problem.

              1 of 1 people found this helpful
              • 4. Re: Migrate JMS from JBoss5 to JBoss7
                max010

                Thanks for you reply.  I do not understand to what deployment descriptor you are referring to.

                 

                In the JBoss5 /deploy/messaging directory I have the following files:

                 

                connection-factories-service.xml

                destinations-service.xml

                jms-ds.xml

                legacy-service.xml

                messaging-jboss-beans.xml

                messaging-service.xml

                mysql-persistence-service.xml

                remoting-bisocket-service.xml

                 

                to which one are you referring to?

                 

                The instructions on https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7 states:

                 

                Transfer the existing JBoss Messaging configurations to the AS7 configuration. These configurations are located in deployment descriptors on the server running JBoss Messaging. This includes the following configurations:

                • Connection Factory service configuration files - these files contain JMS connection factories deployed with JBoss Messaging server. JBoss Messaging stores these files in a file called connection-factories-service.xml in the deployment directory of your application server.
                • Destination service configurations - these files contain JMS queues and topics deployed with JBoss Messaging server. By default, these are stored in a file called destinations-service.xml in the deployment directory of your application server.

                 

                I have added the connection factories and destinations in the standalone.xml.  As you mentioned I am missing more config in another .xml file, but I am not sure which one.

                • 5. Re: Migrate JMS from JBoss5 to JBoss7
                  robert.geisler

                  hello max,

                   

                  i guess justin meant that <resource-env-ref-name> just defines a reference to a resource and their should be another descriptor that defines the resource and its JNDI name.
                  he does not know which descriptor. me too, sorry.


                  i dont know much about web.xml. but i wonder why you need a reference to the topic within your .war.
                  as is understand some EJB in ejb.jar looks up the TopicConnectionFactory and Topic. is that right?
                  than it should be enough to look it up from within your EJB, i think. no need to define a resource!

                   

                  we do create topics in standalone.xml, too. and we are able to look them up within our EJBs.
                  these definitions look similar to yours:

                   

                  <jms-destinations>
                      <jms-topic name="TOPIC_NAME">

                          <entry name="java:/topic/TOPIC_NAME"/>

                          <entry name="java:jboss/exported/topic/TOPIC_NAME"/>

                      </jms-topic>

                  </jms-destinations>


                  some difference i see in entry name: we use java:/topic/ where you use topic/ only.
                  maybe yours is an invalid jms name (see https://community.jboss.org/message/624135#624135)?
                  could that be the reason it does not get deployed!? did you check if your topic gets deployed??

                   

                  i recommend you to use java:/topic/ImportStartTopic instead of topic/ImportStartTopic as entry name of your topic.
                  of course you have to change the static String value IMPORT_START_TOPIC to java:/topic/ImportStartTopic, too.

                   

                  give it a try and let us know if that helps.


                  regards
                  robert

                  • 6. Re: Migrate JMS from JBoss5 to JBoss7
                    jbertram

                    Thanks for you reply.  I do not understand to what deployment descriptor you are referring to.

                    I'm not talking about JBoss deployment descriptors.  I'm talking about the deplment descriptors in your application.  Based on https://docs.jboss.org/author/display/AS72/Deployment+Descriptors+used+In+AS7 I believe it would be jboss-web.xml.  Do you have such a file in your deployment?  If not, you almost certainly should so you can map your resource-enf-ref to a physical resource available in JNDI.

                    • 7. Re: Migrate JMS from JBoss5 to JBoss7
                      max010

                      Thanks for your reply.  I do have the jboss-web.xml deployed in the .war/WEB-INF directory.  The resource-enf-ref is mapped to:

                       

                      <resource-env-ref>

                                          <resource-env-ref-name>jms/ImportStartTopic</resource-env-ref-name>

                                          <jndi-name>java:/topic/ImportStartTopic</jndi-name>

                      </resource-env-ref>

                       

                      <resource-ref>

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

                                          <jndi-name>java:/ConnectionFactory</jndi-name>

                      </resource-ref>

                       

                      <resource-ref>

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

                         <jndi-name>java:/ConnectionFactory</jndi-name>

                      </resource-ref>

                       

                       

                      As Robert suggested I have changed the JNDI name for ImportStartTopic from:

                       

                      topic/ImportStartTopic

                       

                      to:

                       

                      java:/topic/ImportStartTopic

                       

                      I have also changed the same entry in standalone.xml:

                       

                      <jms-destinations>

                                          <jms-queue name="ImporterQueue">

                                                    <entry name="java:/queue/ImporterQueue"/>

                                              <entry name="java:jboss/jms/queue/ImporterQueue"/>

                                          </jms-queue>

                                          <jms-topic name="ImportStartTopic">

                                                    <entry name="java:/topic/ImportStartTopic"/>

                                              <entry name="java:jboss/jms/topic/ImportStartTopic"/>

                                          </jms-topic>

                      </jms-destinations>

                       

                      And now I do not get the missing dependencies errors anymore.  When inspecting the http://localhost:9990/console/App.html#jms-metrics I can verify that the JMS Topic and Queue have been deployed successfully (see JMS-Topic.png). My app is still not working but that is another chapter. Thanks Justin and Robert for your help.

                       

                      JMS-Topic.png