1 2 3 Previous Next 43 Replies Latest reply: Sep 19, 2012 10:05 AM by Justin Bertram RSS

    jboss 7 ActiveMQ integration

    vamshi appala Newbie

      We are using JBOSS6 which is configured with ActiveMQ. We are now migrating from AS6 to AS7.I didnt find any information on how to configure ActiveMQ with JBOSS7.

       

      Below are the steps which I have performed.

      1)copied the activemq-ra.rar to standalone/deployments directory

      2)Added the following information in standalone.xml

       

                 

      <subsystem xmlns="urn:jboss:domain:ee:1.0">

                  <global-modules>

                      <module name="org.postgresql" slot="main"/>

                  </global-modules>

              </subsystem>

       

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

                  <resource-adapters>

                      <resource-adapter>

                          <archive>

                              activemq-ra.rar

                          </archive>

                          <transaction-support>

                              XATransaction

                          </transaction-support>

                          <config-property name="ServerUrl">

                              vm://localhost

                          </config-property>

                          <connection-definitions>

                              <connection-definition class-name="javax.jms.QueueConnectionFactory" jndi-name="java:/activemq/QueueConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQQueueConnectionPool" use-ccm="true">

                                  <config-property name="ServerUrl">

                                      vm://localhost

                                  </config-property>

                                  <pool>

                                      <min-pool-size>

                                          1

                                      </min-pool-size>

                                      <max-pool-size>

                                          200

                                      </max-pool-size>

                                      <prefill>

                                          true

                                      </prefill>

                                      <use-strict-min>

                                          true

                                      </use-strict-min>

                                  </pool>

                              </connection-definition>

                              <connection-definition class-name="javax.jms.TopicConnectionFactory" jndi-name="java:/activemq/TopicConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMqTopicConnectionPool" use-ccm="true">

                                  <config-property name="ServerUrl">

                                      vm://localhost

                                  </config-property>

                                  <pool>

                                      <min-pool-size>

                                          1

                                      </min-pool-size>

                                      <max-pool-size>

                                          200

                                      </max-pool-size>

                                      <prefill>

                                          true

                                      </prefill>

                                      <use-strict-min>

                                          true

                                      </use-strict-min>

                                  </pool>

                              </connection-definition>

                          </connection-definitions>

       

       

      with this configuration ActiveMQ is up and running. Now I coudnt find any information on how make this an embedded broker and how to configure MDBs to listen to the ActiveMQ? How to disable hornetQ and make ActiveMQ as JMS provider?

       

      I am attaching the activemq-jms-ds.xml which we have used in JBOSS6 to configure ActiveMQ as the default JMS provider

      Request to provide the information on how to configure the ActiveMQ with JBOSS7

        • 1. Re: jboss 7 ActiveMQ integration
          Jesper Pedersen Master

          Use the latest snapshot of AS 7 - and replace your "class-name" with the ManagedConnectionFactory class names instead.

           

          Then do

           

          <resource-adapter-ref resource-adapter-name=""/>

           

          in the EJB3 subsystem.

          • 2. Re: jboss 7 ActiveMQ integration
            vamshi appala Newbie

            Hi Jesper,

            Do you meant to say the ManagerConnectionFactory class defined in ra.xml?

             

            I have added the following information to standalone.xml

             

            <mdb>
                            <resource-adapter-ref resource-adapter-name="activemq-ra"/>
                            <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
                        </mdb>

             

             

            <resource-adapters>
                            <resource-adapter>
                                <archive>
                                    activemq-ra.rar
                                </archive>
                                <transaction-support>
                                    XATransaction
                                </transaction-support>
                                <config-property name="ServerUrl">
                                    vm://localhost
                                </config-property>
                                <connection-definitions>
                                    <connection-definition class-name="org.apache.activemq.ra.ActiveMQConnectionFactory" jndi-name="java:/activemq/QueueConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQQueueConnectionPool" use-ccm="true">
                                        <config-property name="ServerUrl">
                                            vm://localhost

            • 3. Re: jboss 7 ActiveMQ integration
              jaikiran pai Master

              Have you been able to get this working now?

              • 4. Re: jboss 7 ActiveMQ integration
                vamshi appala Newbie

                Hi Jaikiran,

                I am getting error similar to

                http://community.jboss.org/thread/169842

                duplicate service exception.

                 

                Thanks

                vamshi

                • 5. Re: jboss 7 ActiveMQ integration
                  vamshi appala Newbie

                  HI Jaikiran,

                  I am able to configure the resource-adapter by which the ActiveMQ broker is UP and my external java application is able to create add a Queue to the ActiveMQ.

                  when I add the @Resource(

                   

                  mappedName =

                  "activemq/QueueConnectionFactory")

                   

                   

                  to my MDB, MDB is not able to find the jndi object for the connection factory

                   

                   

                    <connection-definition  jndi-name="activemq/QueueConnectionFactory" enabled="true" use-java-context="true"  use-ccm="true">

                                              <config-property name="ServerUrl">

                                                  vm://localhost

                                              </config-property>

                   

                  I am unable to find the JNDI object which has been defined in connection-definition, What configuration should we need to set so that connection factory will be set and my MDBS can listen on the Queues defined in ActiveMQ. I am attaching my standalone.xml and ra.xml.

                   

                  Below is the server.log

                   

                  INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "activemq-ra.rar"
                  16:07:05,430 INFO  [org.jboss.as.jpa] (MSC service thread 1-11) added javax.persistence.api dependency to activemq-ra.rar
                  16:07:05,783 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:05,783 [ActiveMQ Broker] INFO  BrokerService                  - Using Persistence Adapter: JournalPersistenceAdapator(JDBCPersistenceAdapter(org.postgresql.ds.PGPoolingDataSource@63fa8d3b))

                  16:07:05,813 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:05,813 [ActiveMQ Broker] INFO  JDBCPersistenceAdapter         - Database adapter driver override recognized for : [postgresql_native_driver] - adapter: class org.apache.activemq.store.jdbc.adapter.PostgresqlJDBCAdapter

                  16:07:05,816 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:05,816 [ActiveMQ Broker] INFO  JDBCPersistenceAdapter         - Database lock driver override not found for : [postgresql_native_driver].  Will use default implementation.

                  16:07:05,818 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:05,818 [ActiveMQ Broker] INFO  DefaultDatabaseLocker          - Attempting to acquire the exclusive lock to become the Master broker

                  16:07:05,834 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:05,834 [ActiveMQ Broker] INFO  DefaultDatabaseLocker          - Becoming the master on dataSource: org.postgresql.ds.PGPoolingDataSource@63fa8d3b

                  16:07:05,837 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:05,837 [ActiveMQ Broker] INFO  BrokerService                  - ActiveMQ null JMS Message Broker (is3.activemq.broker) is starting

                  16:07:05,838 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:05,838 [ActiveMQ Broker] INFO  BrokerService                  - For help or more information please see: http://activemq.apache.org/

                  16:07:06,078 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:06,078 [ActiveMQ Broker] INFO  JournalPersistenceAdapter      - Journal Recovery Started from: Active Journal: using 5 x 20.0 Megs at: C:\test\jboss-as-7.0.1.Final\standalone\data\activemq\journal

                  16:07:06,089 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:06,089 [ActiveMQ Broker] INFO  JournalPersistenceAdapter      - Journal Recovered: 0 message(s) in transactions recovered.

                  16:07:06,146 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:06,145 [ActiveMQ Broker] INFO  TransportServerThreadSupport   - Listening for connections at: tcp://127.0.0.1:61616

                  16:07:06,149 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:06,149 [ActiveMQ Broker] INFO  TransportConnector             - Connector is3.activemq.broker Started

                  16:07:06,151 INFO  [stdout] (Starting ActiveMQ Broker) 2011-09-19 16:07:06,151 [ActiveMQ Broker] INFO  BrokerService                  - ActiveMQ JMS Message Broker (is3.activemq.broker, ID:ALH-VAKW7-LT-61003-1316466425850-0:0) started

                  16:07:06,153 INFO  [org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService$AS7RaXmlDeployer] (MSC service thread 1-13) IJ020002: Deployed: file:/c:/test/jboss-as-7.0.1.Final/standalone/deployments/activemq-ra.rar/
                  16:07:06,155 INFO  [org.jboss.as] (MSC service thread 1-13) JBoss AS 7.0.1.Final "Zap" started in 3134ms - Started 126 of 185 services (59 services are passive or on-demand)
                  16:07:06,188 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "activemq-ra.rar"

                  • 6. Re: jboss 7 ActiveMQ integration
                    jaikiran pai Master

                    vamshi appala wrote:

                     

                    Hi Jaikiran,

                    I am getting error similar to

                    http://community.jboss.org/thread/169842

                    duplicate service exception.

                     

                     

                    That's supposed to be fixed in the latest nightly builds. Which exact version of JBoss AS7 are you using?

                    • 7. Re: jboss 7 ActiveMQ integration
                      jaikiran pai Master

                      when I add the @Resource(mappedName = "activemq/QueueConnectionFactory")

                       

                      to my MDB, MDB is not able to find the jndi object for the connection factory

                       

                      <connection-definition  jndi-name="activemq/QueueConnectionFactory" enabled="true" use-java-context="true"  use-ccm="true">

                                                  <config-property name="ServerUrl">

                                                      vm://localhost

                                                  </config-property>

                       

                      Change the connection-definition jndi-name to java:jboss/activemq/QueueConnectionFactory and then the @Resource to:

                       

                      @Resource(mappedName = "java:jboss/activemq/QueueConnectionFactory")

                      • 8. Re: jboss 7 ActiveMQ integration
                        vamshi appala Newbie

                        Hi Jaikiran,

                        I have downloaded the jboss 7.1.0 alpha snapshot which is a week ago and configured resource adapater as shown below

                         

                        <resource-adapters>

                                        <resource-adapter>

                                            <archive>

                                                activemq-ra.rar

                                            </archive>

                                            <transaction-support>

                                                XATransaction

                                            </transaction-support>

                                            <connection-definitions>

                                                <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:jboss/activemq/QueueConnectionFactory">

                                                    <config-property name="ServerUrl">

                                                        vm://localhost

                                                    </config-property>

                                                    <pool>

                                                        <min-pool-size>

                                                            1

                                                        </min-pool-size>

                                                        <max-pool-size>

                                                            200

                                                        </max-pool-size>

                                                    </pool>

                                                </connection-definition>

                                            </connection-definitions>

                                            <admin-objects>

                                                <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="activemq/queue/outbound">

                                                    <config-property name="Type">

                                                        javax.jms.Queue

                                                    </config-property>

                                                    <config-property name="Properties">

                                                        PhysicalName=queue.outbound

                                                    </config-property>

                                                </admin-object>

                                                <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="activemq/topic/inbound">

                                                    <config-property name="Type">

                                                        javax.jms.Topic

                                                    </config-property>

                                                    <config-property name="Properties">

                                                        PhysicalName=topic.inbound

                                                    </config-property>

                                                </admin-object>

                                            </admin-objects>

                                        </resource-adapter>

                                    </resource-adapters>

                        When t he connection defintion contains class name then I get the duplicate service exception as shown below

                         

                         

                        06:33:28,644 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-7) JBAS010406: Registered connection factory java:jboss/activemq/QueueConnectionFactory

                        06:33:28,650 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-7) JBAS010406: Registered connection factory java:jboss/activemq/QueueConnectionFactory

                        06:33:28,654 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.raxml.activemq-ra_1: org.jboss.msc.service.StartException in service jboss.raxml.activemq-ra_1: org.jboss.msc.service.StartException in anonymous service: Failed to start RA deployment [activemq-ra]

                        at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:120)

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]

                        at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]

                        Caused by: org.jboss.msc.service.StartException in anonymous service: Failed to start RA deployment [activemq-ra]

                        at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:105)

                        ... 5 more

                        Caused by: org.jboss.jca.deployers.common.DeployException: IJ020056: Deployment failed: file:/c:/IS3/JS7/jboss-as-7.1.0/standalone/deployments/activemq-ra.rar/

                        at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:1977)

                        at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService$AS7RaXmlDeployer.doDeploy(ResourceAdapterXmlDeploymentService.java:154)

                        at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:103)

                        ... 5 more

                        Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.connector.connection-factory.java:jboss/activemq/QueueConnectionFactory is already registered

                        at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                        at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:226) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                        at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:560) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                        at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                        at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2211) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                        at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                        at org.jboss.as.connector.metadata.deployment.AbstractResourceAdapterDeploymentService$AbstractAS7RaDeployer.bindConnectionFactory(AbstractResourceAdapterDeploymentService.java:228)

                        at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:1765)

                        ... 7 more

                         

                         

                         

                        Now If i remove the class-name, then  I get the error in admin-object, which I was not getting in Zap version. could you look at the attached ActiveMQ ra.xml , standalone.xml and Jboss6 specific activemq-jms-ds.xml and let me know whether I am configuring properly? If this is not configured properly what should I do to configure the resource-adapter properly so that my ActiveMQ will be default messaging provider and my MDB can listen to them.

                        I have experimented a lot but I am not successful in making my activemq integration working.

                        • 9. Re: jboss 7 ActiveMQ integration
                          steve mebius Newbie

                          Does anyone finally get the Jboss 7 (in my case Jboss 7.1.1 final) integrated with a remote JMS provider (in my case JBoss 4.2.3)?

                           

                          If you can get it working, could you post your working config files (e.g., standalone.xml and etc)?

                           

                          If you have any interesting discoveries, coudl you share?

                           

                          Thanks in advance.

                           

                          Below is a description of the issue I am facing:

                           

                          I have a JBoss 4.2.3 MDB which is talking to a JBoss 4.2.3 JMS instance.

                           

                          Now I want to migrate the MDB to JBoss 7.1.1 but keep talking to the same JBoss 4.2.3 JMS instance (as phrase 1).

                           

                          I think I need to add some setup in standalone.xml but I don't know exactly what to add, or where, or how.

                           

                          The anontation of my MDB code looks like this:

                           

                          ======

                          @MessageDriven(activationConfig = {

                                  @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "auto-acknowledge"),

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

                                  @ActivationConfigProperty(propertyName = "destination", propertyValue = "/topic/broadcast"),

                                  @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "channel='general'"),

                                  @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),

                                  @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "xyz-broadcast"),

                                  @ActivationConfigProperty(propertyName = "clientId", propertyValue = "listener-xyz"),

                                  @ActivationConfigProperty(propertyName = "providerAdapterJNDI", propertyValue = "java:/RemoteJMSProvider") })

                          // We are using Spring transaction management so disable CMT

                          @TransactionManagement(TransactionManagementType.BEAN)

                          =====

                           

                          My Jboss 4.2.3 setup (default/deploy/jms/jms-ds.xml) for JMS looks like this:

                           

                          ======

                          ...

                          <mbean code="org.jboss.jms.jndi.JMSProviderLoader"

                                name="jboss.mq:service=JMSProviderLoader,name=RemoteJMSProvider,server=remotehost">

                              <attribute name="ProviderName">RemoteJMSProvider</attribute>

                              <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>

                              <!-- The connection factory -->

                              <attribute name="FactoryRef">UIL2XAConnectionFactory</attribute>

                              <!-- The queue connection factory -->

                              <attribute name="QueueFactoryRef">UIL2XAConnectionFactory</attribute>

                              <!-- The topic factory -->

                              <attribute name="TopicFactoryRef">UIL2XAConnectionFactory</attribute>

                              <!-- Connect to JNDI on the host "the-remote-host-name" port 1099-->

                              <attribute name="Properties">

                                 java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

                                 java.naming.factory.url.pkgs=org.jnp.interfaces

                                 java.naming.provider.url=hostxyz:1099

                              </attribute>

                            </mbean>

                          =========

                           

                          I think I can reuse the existing jbossall-client.jar to provide me all the needed classes for accessing JNP protocol.

                           

                          I think all I need is the right configuration in Jboss 7.1.1 to complete the task.

                          • 10. Re: jboss 7 ActiveMQ integration
                            Justin Bertram Master

                            I just answered your question on a different thread.  Please don't post the same question on multiple threads.  Thanks.

                            • 11. Re: jboss 7 ActiveMQ integration
                              Cav Edwards Newbie

                              Hi Justin,

                               

                              Is there a link to the solution you provided in the different thread ?

                               

                              Thanks in advance.

                              • 13. Re: jboss 7 ActiveMQ integration
                                Cav Edwards Newbie

                                Many thanks Jaikiran

                                • 14. Re: jboss 7 ActiveMQ integration
                                  Cav Edwards Newbie

                                  I also found this : https://blog.coffeebeans.at/?p=230

                                   

                                  Titled, JBoss 7 and Active MQ finally work together.

                                   

                                  I am working through it now.

                                  1 2 3 Previous Next