6 Replies Latest reply on Jun 28, 2012 12:23 PM by Cav Edwards

    JBOSS EJB(MDB) outbound to ActiveMQ - JCA

    goldengate001 Newbie

      This is in reference to the JCA approach suggested by Justin in https://community.jboss.org/message/742498

       

      Below are the requirements.

       

      1. Web services post a message to the local HornetQ.

      2. MDB moves the message from the local HornetQ to remove ActiveMQ.

       

      Below is what I did.

       

      1. Grabbed the activemq-rar-5.4.2.rar and copied it on the standalone/deployments folder.

      2. Added the following in standalone-full.xml

       

          <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
              <resource-adapters>
                  <resource-adapter>
                      <archive>activemq-rar-5.4.2.rar</archive>
                      <transaction-support>XATransaction</transaction-support>
                      <connection-definitions>
                          <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:jboss/activemq/TopicConnectionFactory">
                              <config-property name="ServerUrl">tcp://192.168.16.73:61616</config-property>
                              <xa-pool>
                                  <min-pool-size>1</min-pool-size>
                                  <max-pool-size>20</max-pool-size>
                              </xa-pool>
                          </connection-definition>
                      </connection-definitions>
                      <admin-objects>
                          <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="activemq/topic/outbound">
                              <config-property name="Type">javax.jms.Topic</config-property>
                              <config-property name="Properties">PhysicalName=Alchemy.Central</config-property>
                          </admin-object>
                      </admin-objects>
                  </resource-adapter>
              </resource-adapters>
          </subsystem>

       

      Upon starting the JBOSS server, I am getting the following error on the log.

       

      15:19:42,108 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.ra.deployment."activemq-rar-5.4.2.rar_1": org.jboss.msc.service.StartException in service jboss.ra.deployment."activemq-rar-5.4.2.rar_1": org.jboss.msc.service.StartException in anonymous service: JBAS010446: Failed to start RA deployment [activemq-rar-5.4.2]

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

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

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

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

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

          at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_33]

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

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

          ... 5 more

      Caused by: org.jboss.jca.deployers.common.DeployException: IJ020056: Deployment failed: file:/Applications/jboss-as-7.1.1.Final/alchemy1/tmp/vfs/temp1433f11e87ca136/activemq-rar-5.4.2.rar-1a7591724e20e08f/contents/

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

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

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

          ... 5 more

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

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

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

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

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

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

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

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

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

          ... 7 more

       

      I can confirm that the activemq/TopicConnectionFactory is not already registered, for the server to throw this exception. Thanks!

        • 1. Re: JBOSS EJB(MDB) outbound to ActiveMQ - JCA
          Jesper Pedersen Master

          Use latest snapshot of AS7

          1 of 1 people found this helpful
          • 2. Re: JBOSS EJB(MDB) outbound to ActiveMQ - JCA
            goldengate001 Newbie

            Used the latest snapshot of AS7. Here is the error.

             

            -------------------------------------

             

            17:00:48,430 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.ra.deployment."activemq-rar-5.4.2.rar_1": org.jboss.msc.service.StartException in service jboss.ra.deployment."activemq-rar-5.4.2.rar_1": org.jboss.msc.service.StartException in anonymous service: JBAS010446: Failed to start RA deployment [activemq-rar-5.4.2]

                at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:128)

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

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

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

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

                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_33]

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

                at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:112)

                ... 5 more

            Caused by: org.jboss.jca.deployers.common.DeployException: IJ020060: Unable to inject: org.apache.activemq.command.ActiveMQTopic property: Type value: javax.jms.Topic

                at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.initAdminObject(AbstractResourceAdapterDeployer.java:851)

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

                at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService$AS7RaXmlDeployer.doDeploy(ResourceAdapterXmlDeploymentService.java:180)

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

                ... 5 more

             

             

            -------------------------------------

            • 3. Re: JBOSS EJB(MDB) outbound to ActiveMQ - JCA
              goldengate001 Newbie

              This is fixed now by using the latest JBOSS nightly build and correcting the resource adapter configuration. Thanks!

              • 4. Re: JBOSS EJB(MDB) outbound to ActiveMQ - JCA
                Justin Bertram Master

                Please post the working configuration for future reference.  Based on the previous exception I take it the topic admin object wasn't configured properly.  What was the problem?

                • 5. Re: JBOSS EJB(MDB) outbound to ActiveMQ - JCA
                  goldengate001 Newbie

                  Justin,

                   

                  The error that I posted earlier was for incorrectly configuring the admin object(you are right!).

                  Below is the corrected and working configuration. I am using ActiveMQ 5.4.2 and the latest nightly build of JBOSS.

                   

                  <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
                      <resource-adapters>
                          <resource-adapter>
                              <archive>
                                  activemq-rar-5.4.2.rar
                              </archive>
                              <transaction-support>XATransaction</transaction-support>
                              <config-property name="ServerUrl">
                                  tcp://192.168.16.73:61616
                              </config-property>
                              <connection-definitions>
                                  <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:jboss/activemq/TopicConnectionFactory" enabled="true" use-java-context="true" pool-name="TopicConnection" use-ccm="true">
                                      <xa-pool>
                                          <min-pool-size>1</min-pool-size>
                                          <max-pool-size>20</max-pool-size>
                                      </xa-pool>
                                  </connection-definition>
                              </connection-definitions>
                              <admin-objects>
                                  <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:jboss/activemq/topic/outbound" enabled="true" use-java-context="true" pool-name="ActiveMQTopic">
                                      <config-property name="PhysicalName">
                                          Alchemy.Central
                                      </config-property>
                                  </admin-object>
                              </admin-objects>
                          </resource-adapter>
                      </resource-adapters>
                  </subsystem>
                  
                  

                  Attached is the MDB code consuming the message from HornetQ and posting to ActiveMQ. Thanks!

                   

                  Message was edited by: jaikiran pai - Fixed formatting

                  • 6. Re: JBOSS EJB(MDB) outbound to ActiveMQ - JCA
                    Cav Edwards Newbie

                    For a inVM configuration, what is the server URL ? In previous examples this was vm://localhost (as an example).

                     

                    Is it the same here ?

                     

                    Thanks in advance.