11 Replies Latest reply on Aug 5, 2015 9:50 AM by jbertram

    Adding Activemq to full-ha profile on wildfly domain configuration

    bohremsdaq

      I am using Wildfly 8.2.2 and trying to add the activemq connection broker to send messages between our server and clients. When I add the Activemq under resource definition it is using java:/ConnectionFactory" enabled="true" pool-name="ConnectionFactory".

      But when I start the application it seems to want hornetq to be the default messaging server.

       

      How do I set my topics to be sent via activemq and the server clustering to be done via hornetq, or should i be looking at replacing hornetq with activemq for all messaging responisbilities?

      I cannot change the jndi-name as the code is looking for that specifically.

        • 1. Re: Adding Activemq to full-ha profile on wildfly domain configuration
          jbertram

          It's not clear to me what exactly your trying to achieve.  Are you wanting to configure Wildfly with an ActiveMQ broker or simply a connection factory you can use to send messages to a remote ActiveMQ broker running somewhere else on your network?

          • 2. Re: Adding Activemq to full-ha profile on wildfly domain configuration
            bohremsdaq

            Justin,

             

            Thanks for the response. I have a Client Application that uses specific topics via an ActiveMQ broker (we are using activemq as a standalone application) I am trying to add the ActiveMQ Broker to Wildfly, and then use it to communicate to our client application. I have added the attached in my full-ha profile, however when I launch my application, it says that topic/targeted is not a hornetq destination.

             

            " javax.jms.InvalidDestinationException: Not a HornetQ Destination:topic://targeted

                    at org.hornetq.jms.client.HornetQSession.createProducer(HornetQSession.java:314)

            "

            I am new to Wildfly and understand that hornetq is used to do the clustering, which I have got working, but I need to use activmeq for our client connections.

             

            Many Thanks

            • 3. Re: Adding Activemq to full-ha profile on wildfly domain configuration
              jbertram

              Are you actually using HornetQ for anything specific in your application?  If not, you can remove it from your configuration.

               

              If HornetQ is deployed then by default there will be a HornetQ connection factory which is bound to "java:/ConnectionFactory" which means you would need to modify that in order to bind your ActiveMQ connection factory to "java:/ConnectionFactory".

              • 4. Re: Adding Activemq to full-ha profile on wildfly domain configuration
                bohremsdaq

                Justin,

                 

                No we are not using hornetq at all for our application. It is deployed by default as the clustering message queue. If (and how do i remove it) I remove the hornetq server will Wildfly use Activemq for the clustering? This is all very new to me, so I may be misunderstanding what the hornetq is doing with the cluster.

                Thanks

                • 5. Re: Adding Activemq to full-ha profile on wildfly domain configuration
                  jbertram

                  No we are not using hornetq at all for our application. It is deployed by default as the clustering message queue.

                  If you're not using HornetQ in your application then you should probably just remove it (just remove the HornetQ subsystem from the XML configuration).

                   

                  If (and how do i remove it) I remove the hornetq server will Wildfly use Activemq for the clustering? This is all very new to me, so I may be misunderstanding what the hornetq is doing with the cluster.

                  I'm not sure what you mean about Wildfly using ActiveMQ for clustering.  If you're running an ActiveMQ cluster then that would be completely separate from Wildfly.

                  • 6. Re: Adding Activemq to full-ha profile on wildfly domain configuration
                    bohremsdaq

                    Justin,

                    Thanks again. I will remove the hornetq subsystem from the XML Configuration.

                    I am not talking about activemq Clustering. What I am trying to achieve is to have our war file running in Wildfly within a domain configuration so I only have to upload new versions/make changes once and they will be propagated down to the other Wildfly instances. Along with this I am looking at implementing the mod_cluster for load balancing. AS I mention this is all very new and I though that hornetq was being used by the wildfly application server to do the wildfly clustering.

                    • 7. Re: Adding Activemq to full-ha profile on wildfly domain configuration
                      jbertram

                      What I am trying to achieve is to have our war file running in Wildfly within a domain configuration so I only have to upload new versions/make changes once and they will be propagated down to the other Wildfly instances.

                      This is facilitated by Wildfly's domain functionality and has nothing to do with HornetQ.

                       

                      Along with this I am looking at implementing the mod_cluster for load balancing. AS I mention this is all very new and I though that hornetq was being used by the wildfly application server to do the wildfly clustering.

                      As above, the mod_cluster functionality is facilitated by mod_cluster itself and has nothing to do with HornetQ.

                      • 8. Re: Adding Activemq to full-ha profile on wildfly domain configuration
                        bohremsdaq

                        Thanks Justin. I will give your recommendations a try. I am away for a few days now, so Will try it on return. Thank you for taking the time to explain to a new comer to Wildfly.

                        • 9. Re: Adding Activemq to full-ha profile on wildfly domain configuration
                          bohremsdaq

                          Justin,

                           

                          I removed the hornetq messaging server from the xml  and it now uses activemq as the default messaging queue. Once again thanks for taking your time to point me in the right direction.

                          Just for info I also looked at JBoss AS7 Tuning and slimming subsystems and removed the extension module they reference as well.

                          • 10. Re: Adding Activemq to full-ha profile on wildfly domain configuration
                            bohremsdaq

                            Justin,

                             

                            It seems I was a bit premature in celebrations. It cleared the error, trying to use hornetq to bind the topics, but now when I am trying top use activemq I get this error message

                            " java.lang.ClassCastException: org.apache.activemq.command.ActiveMQTopic cannot be cast to javax.jms.Topic" I have been trying for a few days to get this right. Any chance you could point me in the right direction again?

                             

                            This is in my Domain.xml

                            <mdb>

                                                <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-rar.rar}"/>

                                                <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>

                            </mdb>

                             

                            <subsystem xmlns="urn:jboss:domain:resource-adapters:3.0">

                                            <resource-adapters>

                                                <resource-adapter id="activemq-rar.rar">

                                                    <module slot="main" id="org.apache.activemq"/>

                                                    <transaction-support>XATransaction</transaction-support>

                                                    <config-property name="ServerUrl">

                                                        tcp://10.14.5.130:61616?jms.rmIdFromConnectionId=true

                                                    </config-property>

                                                    <config-property name="UserName">

                                                        admin

                                                    </config-property>

                                                    <config-property name="UseInboundSession">

                                                        false

                                                    </config-property>

                                                    <config-property name="Password">

                                                        admin

                                                    </config-property>

                                                    <connection-definitions>

                                                        <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ConnectionFactory" enabled="true" pool-name="ConnectionFactory">

                                                            <xa-pool>

                                                                <min-pool-size>1</min-pool-size>

                                                                <max-pool-size>20</max-pool-size>

                                                                <prefill>false</prefill>

                                                                <is-same-rm-override>false</is-same-rm-override>

                                                            </xa-pool>

                                                        </connection-definition>

                                                    </connection-definitions>

                                                    <admin-objects>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/alert" use-java-context="true" pool-name="alert">

                                                            <config-property name="PhysicalName">

                                                                alert

                                                            </config-property>

                                                        </admin-object>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/targeted" use-java-context="true" pool-name="targeted">

                                                            <config-property name="PhysicalName">

                                                                targeted

                                                            </config-property>

                                                        </admin-object>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/deleteall" use-java-context="true" pool-name="deleteall">

                                                            <config-property name="PhysicalName">

                                                                deleteall

                                                            </config-property>

                                                        </admin-object>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/update" use-java-context="true" pool-name="update">

                                                            <config-property name="PhysicalName">

                                                                update

                                                            </config-property>

                                                        </admin-object>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/create" use-java-context="true" pool-name="create">

                                                            <config-property name="PhysicalName">

                                                                create

                                                            </config-property>

                                                        </admin-object>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/delete" use-java-context="true" pool-name="delete">

                                                            <config-property name="PhysicalName">

                                                                delete

                                                            </config-property>

                                                        </admin-object>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/eisec" use-java-context="true" pool-name="eisec">

                                                            <config-property name="PhysicalName">

                                                                eisec

                                                            </config-property>

                                                        </admin-object>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/statsupdated" use-java-context="true" pool-name="statsupdated">

                                                            <config-property name="PhysicalName">

                                                                statsupdated

                                                            </config-property>

                                                      </admin-object>

                                                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/statstargeted" use-java-context="true" pool-name="statstargeted">

                                                            <config-property name="PhysicalName">

                                                                statstargeted

                                                            </config-property>

                                                        </admin-object>

                                                    </admin-objects>

                                               </resource-adapter>

                                            </resource-adapters>

                                        </subsystem>

                             

                            I have in $JBOSS_HOME/modules/system/layers/base/org/apache/activemq/main

                             

                            activemq-broker-5.9.0.jar    activemq-kahadb-store-5.9.0.jar     activemq-protobuf-1.1.jar  aopalliance-1.0.jar        hawtbuf-1.9.jar  spring-aop-3.2.4.RELEASE.jar      spring-core-3.2.4.RELEASE.jar

                            activemq-client-5.9.0.jar    activemq-openwire-legacy-5.9.0.jar  activemq-ra-5.9.0.jar      commons-logging-1.1.3.jar  META-INF         spring-beans-3.2.4.RELEASE.jar    spring-expression-3.2.4.RELEASE.jar

                            activemq-jms-pool-5.9.0.jar  activemq-pool-5.9.0.jar             activemq-spring-5.9.0.jar  commons-pool-1.6.jar       module.xml       spring-context-3.2.4.RELEASE.jar  xbean-spring-3.14.jar

                             

                            In module.xml

                            <module xmlns="urn:jboss:module:1.1" name="org.apache.activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                              <resources>

                                <resource-root path="."/>

                                <resource-root path="activemq-broker-5.9.0.jar"/>

                                <resource-root path="activemq-client-5.9.0.jar"/>

                                <resource-root path="activemq-jms-pool-5.9.0.jar"/>

                                <resource-root path="activemq-kahadb-store-5.9.0.jar"/>

                                <resource-root path="activemq-openwire-legacy-5.9.0.jar"/>

                                <resource-root path="activemq-pool-5.9.0.jar"/>

                                <resource-root path="activemq-protobuf-1.1.jar"/>

                                <resource-root path="activemq-ra-5.9.0.jar"/>

                                <resource-root path="activemq-spring-5.9.0.jar"/>

                                <resource-root path="aopalliance-1.0.jar"/>

                                <resource-root path="commons-pool-1.6.jar"/>

                                <resource-root path="commons-logging-1.1.3.jar"/>

                                <resource-root path="hawtbuf-1.9.jar"/>

                                <resource-root path="spring-aop-3.2.4.RELEASE.jar"/>

                                <resource-root path="spring-beans-3.2.4.RELEASE.jar"/>

                                <resource-root path="spring-context-3.2.4.RELEASE.jar"/>

                                <resource-root path="spring-core-3.2.4.RELEASE.jar"/>

                                <resource-root path="spring-expression-3.2.4.RELEASE.jar"/>

                                <resource-root path="xbean-spring-3.14.jar"/>

                              </resources>

                              <exports>

                                <exclude path="org/springframework/**"/>

                                <exclude path="org/apache/xbean/**"/>

                                <exclude path="org/apache/commons/**"/>

                                <exclude path="org/aopalliance/**"/>

                                <exclude path="org/fusesource/**"/>

                              </exports>

                              <dependencies>

                                <module name="javax.api"/>

                                <module name="org.slf4j"/>

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

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

                                <module name="javax.management.j2ee.api"/>

                              </dependencies>

                            </module>

                             

                            Thanks Again for your help

                            • 11. Re: Adding Activemq to full-ha profile on wildfly domain configuration
                              jbertram

                              I'm not sure what the problem could be.  Usually stuff like this is related to classloading.  Make sure you don't have 2 references to or instances of javax.jms.Topic in your module.