"ResourceAdapter already set" error listening to ActiveMQ
ned233 Jan 23, 2012 2:42 PMConfiguration: jboss-as-7.1.0.CR1b
I am trying to get an MDB deployed on JBoss to listen to an ActiveMQ queue. Utlimately, this ActiveMQ queue will be running on a remote server. Here is what I have done, just to test this out locally on my workstation:
1. Installed ActiveMQ locally and created a queue called "amqTest"
2. Put the activemq-rar-5.4.3.rar file in standalone/deployments
3. Added the following resource adapter info in standalone.xml:
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
<resource-adapters>
<resource-adapter>
<archive>activemq-rar-5.4.3.rar</archive>
<transaction-support>XATransaction</transaction-support>
<config-property name="ServerUrl">tcp://localhost:61616</config-property>
<connection-definitions>
<connection-definition class-name="javax.jms.QueueConnectionFactory" jndi-name="java:jboss/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-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>
4. Created an MDB with the following annotations:
@MessageDriven(name="TestAQService", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/amqTest") })
@TransactionManagement(value= TransactionManagementType.CONTAINER)
@TransactionAttribute(value= TransactionAttributeType.REQUIRED)
@ResourceAdapter("activemq-rar-5.4.3.rar")
When I start JBoss with these changes, I get the following error:
14:34:41,270 ERROR [org.jboss.msc.service.fail] MSC00001: Failed to start service jboss.deployment.subunit."trade-services.ear"."trade-services.jar".component.TestAQService.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."trade-services.ear"."trade-services.jar".component.TestAQService.CREATE: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0_02]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0_02]
at java.lang.Thread.run(Thread.java:722) [:1.7.0_02]
Caused by: java.lang.RuntimeException: javax.resource.ResourceException: ResourceAdapter already set
at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:75)
at org.jboss.as.ee.component.BasicComponentCreateService.start(BasicComponentCreateService.java:84)
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]
... 3 more
Caused by: javax.resource.ResourceException: ResourceAdapter already set
at org.apache.activemq.ra.ActiveMQActivationSpec.setResourceAdapter(ActiveMQActivationSpec.java:234)
at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:73)
... 6 more
Is there something I am missing here?
Thanks,
Ed