0 Replies Latest reply on Oct 18, 2011 10:30 AM by insipid

    DuplicateServiceException not fixed? (Alpha2 snapshot last night)

    insipid Newbie

      Perhaps I am doing something wrong, but I am not able to deploy a resource adapter when there are multiple declarations of a ManagedConnectionFactory in the ra.xml.  Even with the workaround in JBJCA-641, I get a DuplicateServiceException...

       

      Related Links

       

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

      https://issues.jboss.org/browse/JBJCA-641

       

      Here is the standalone.xml entry

       

      <resource-adapter>

      <archive>activemq-rar-5.4.2.rar</archive>

      <connection-definitions>

      <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/eis/activemq" enabled="true" use-java-context="true" pool-name="AmqPool" use-ccm="true">

      <config-property name="ServerUrl">tcp://localhost:61616</config-property>

      <config-property name="UserName">defaultUser</config-property>

      <config-property name="Password">defaultPassword</config-property>

      <config-property name="Clientid">""</config-property>

      <config-property name="UseInboundSession">false</config-property>

      </connection-definition>

      <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/eis/activemq2" enabled="true" use-java-context="true" pool-name="Amq2Pool" use-ccm="true">

      <config-property name="ServerUrl">tcp://localhost:61616</config-property>

      <config-property name="UserName">defaultUser</config-property>

      <config-property name="Password">defaultPassword</config-property>

      <config-property name="Clientid">""</config-property>

      <config-property name="UseInboundSession">false</config-property>

      </connection-definition>

      <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/eis/activemq3" enabled="true" use-java-context="true" pool-name="Amq3Pool" use-ccm="true">

      <config-property name="ServerUrl">tcp://localhost:61616</config-property>

      <config-property name="UserName">defaultUser</config-property>

      <config-property name="Password">defaultPassword</config-property>

      <config-property name="Clientid">""</config-property>

      <config-property name="UseInboundSession">false</config-property>

      </connection-definition>

      </connection-definitions>

      <admin-objects>

      <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/eis/activemqQueue">

      <config-property name="PhysicalName">""</config-property>

      </admin-object>

      <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/eis/activemqTopic">

      <config-property name="PhysicalName">""</config-property>

      </admin-object>

      </admin-objects>

      </resource-adapter>

       

      Here is the ra.xml

       

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

      <!--

          Licensed to the Apache Software Foundation (ASF) under one or more

          contributor license agreements.  See the NOTICE file distributed with

          this work for additional information regarding copyright ownership.

          The ASF licenses this file to You under the Apache License, Version 2.0

          (the "License"); you may not use this file except in compliance with

          the License.  You may obtain a copy of the License at

       

          http://www.apache.org/licenses/LICENSE-2.0

       

          Unless required by applicable law or agreed to in writing, software

          distributed under the License is distributed on an "AS IS" BASIS,

          WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

          See the License for the specific language governing permissions and

          limitations under the License.

      -->

       

      <connector xmlns="http://java.sun.com/xml/ns/j2ee"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

          http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"

          version="1.5">

          <description>ActiveMQ  inbound and outbound JMS ResourceAdapter</description>

          <display-name>ActiveMQ JMS Resource Adapter</display-name>

          <vendor-name>activemq.org</vendor-name>

          <eis-type>JMS 1.1</eis-type>

          <resourceadapter-version>1.0</resourceadapter-version>

          <license>

              <description>

          Licensed to the Apache Software Foundation (ASF) under one or more

          contributor license agreements.  See the NOTICE file distributed with

          this work for additional information regarding copyright ownership.

          The ASF licenses this file to You under the Apache License, Version 2.0

          (the "License"); you may not use this file except in compliance with

          the License.  You may obtain a copy of the License at

       

          http://www.apache.org/licenses/LICENSE-2.0

       

          Unless required by applicable law or agreed to in writing, software

          distributed under the License is distributed on an "AS IS" BASIS,

          WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

          See the License for the specific language governing permissions and

          limitations under the License.

              </description>

              <license-required>true</license-required>

          </license>

          <resourceadapter>

              <resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>

              <config-property>

                  <description>

                    The URL to the ActiveMQ server that you want this connection to connect to.  If using

                    an embedded broker, this value should be 'vm://localhost'.

                  </description>

                  <config-property-name>ServerUrl</config-property-name>

                  <config-property-type>java.lang.String</config-property-type>

                  <config-property-value>tcp://localhost:61616</config-property-value>

                  <!-- <config-property-value>vm://localhost</config-property-value> -->

              </config-property>

              <config-property>

                  <description>The default user name that will be used to establish connections to the ActiveMQ server.</description>

                  <config-property-name>UserName</config-property-name>

                  <config-property-type>java.lang.String</config-property-type>

                  <config-property-value>defaultUser</config-property-value>

              </config-property>

              <config-property>

                  <description>The default password that will be used to log the default user into the ActiveMQ server.</description>

                  <config-property-name>Password</config-property-name>

                  <config-property-type>java.lang.String</config-property-type>

                  <config-property-value>defaultPassword</config-property-value>

              </config-property>

              <config-property>

                  <description>The client id that will be set on the connection that is established to the ActiveMQ server.</description>

                  <config-property-name>Clientid</config-property-name>

                  <config-property-type>java.lang.String</config-property-type>

              </config-property>

              <config-property>

                  <description>Boolean to configure if outbound connections should reuse the inbound connection's session for sending messages.</description>

                  <config-property-name>UseInboundSession</config-property-name>

                  <config-property-type>java.lang.Boolean</config-property-type>

                  <config-property-value>false</config-property-value>

              </config-property>

       

      <!-- NOTE disable the following property if you do not wish to deploy an embedded broker -->

              <config-property>

                  <description>

                    Sets the XML configuration file used to configure the embedded ActiveMQ broker via

                    Spring if using embedded mode.

       

                    BrokerXmlConfig is the filename which is assumed to be on the classpath unless

                    a URL is specified. So a value of foo/bar.xml would be assumed to be on the

                    classpath whereas file:dir/file.xml would use the file system.

                    Any valid URL string is supported.

                  </description>

                  <config-property-name>BrokerXmlConfig</config-property-name>

                  <config-property-type>java.lang.String</config-property-type>

                  <config-property-value></config-property-value>

                  <!--

                   To use the broker-config.xml from the root for the RAR

                     <config-property-value>xbean:broker-config.xml</config-property-value>

                   To use an external file or url location

                     <config-property-value>xbean:file:///amq/config/jee/broker-config.xml</config-property-value>

                  -->

              </config-property>

       

              <outbound-resourceadapter>

                  <connection-definition>

                      <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>

                      <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>

                      <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>

                      <connection-interface>javax.jms.Connection</connection-interface>

                      <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>

                  </connection-definition>

                  <connection-definition>

                      <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>

                      <connectionfactory-interface>javax.jms.QueueConnectionFactory</connectionfactory-interface>

                      <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>

                      <connection-interface>javax.jms.QueueConnection</connection-interface>

                      <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>

                  </connection-definition>

                  <connection-definition>

                      <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>

                      <connectionfactory-interface>javax.jms.TopicConnectionFactory</connectionfactory-interface>

                      <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>

                      <connection-interface>javax.jms.TopicConnection</connection-interface>

                      <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>

                  </connection-definition>

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

                  <authentication-mechanism>

                      <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>

                      <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>

                  </authentication-mechanism>

                  <reauthentication-support>false</reauthentication-support>

              </outbound-resourceadapter>

              <inbound-resourceadapter>

                  <messageadapter>

                      <messagelistener>

                          <messagelistener-type>javax.jms.MessageListener</messagelistener-type>

                          <activationspec>

                              <activationspec-class>org.apache.activemq.ra.ActiveMQActivationSpec</activationspec-class>

       

                              <required-config-property>

                                  <config-property-name>destination</config-property-name>

                              </required-config-property>

                              <required-config-property>

                                  <config-property-name>destinationType</config-property-name>

                              </required-config-property>

       

                          </activationspec>

                      </messagelistener>

                  </messageadapter>

              </inbound-resourceadapter>

              <adminobject>

                  <adminobject-interface>javax.jms.Queue</adminobject-interface>

                  <adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>

                  <config-property>

                      <config-property-name>PhysicalName</config-property-name>

                      <config-property-type>java.lang.String</config-property-type>

                  </config-property>

              </adminobject>

              <adminobject>

                  <adminobject-interface>javax.jms.Topic</adminobject-interface>

                  <adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>

                  <config-property>

                      <config-property-name>PhysicalName</config-property-name>

                      <config-property-type>java.lang.String</config-property-type>

                  </config-property>

              </adminobject>

          </resourceadapter>

      </connector>

       

      Server Log

       

      08:55:49,577 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) Starting deployment of "activemq-rar-5.4.2.rar"

      08:55:52,885 DEBUG [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api dependency to activemq-rar-5.4.2.rar

      08:55:53,214 DEBUG [org.jboss.modules] (MSC service thread 1-4) Module deployment.activemq-rar-5.4.2.rar:main defined by Service Module Loader

      08:55:53,575 DEBUG [org.jboss.as.deployment.connector] (MSC service thread 1-5) DEPLOYMENT name = activemq-rar-5.4.2

      08:55:53,578 INFO  [org.jboss.as.connector.deployers.RADeployer] (MSC service thread 1-5) IJ020001: Required license terms for file:/C:/CWS/jboss-as-7.1.0.Alpha2-SNAPSHOT/standalone/tmp/vfs/tempc4a26ee87bf31f4e/activemq-rar-5.4.2.rar-aa5c9a0956375817/contents/

      08:55:53,593 DEBUG [org.jboss.as.connector.deployers.RADeployer] (MSC service thread 1-5) No activation: org.apache.activemq.ra.ActiveMQManagedConnectionFactory

      08:55:53,594 DEBUG [org.jboss.as.connector.deployers.RADeployer] (MSC service thread 1-5) No activation: org.apache.activemq.ra.ActiveMQManagedConnectionFactory

      08:55:53,595 DEBUG [org.jboss.as.connector.deployers.RADeployer] (MSC service thread 1-5) No activation: org.apache.activemq.ra.ActiveMQManagedConnectionFactory

      08:55:53,610 DEBUG [org.jboss.as.connector.deployers.RADeployer] (MSC service thread 1-5) No activation: org.apache.activemq.command.ActiveMQQueue

      08:55:53,611 DEBUG [org.jboss.as.connector.deployers.RADeployer] (MSC service thread 1-5) No activation: org.apache.activemq.command.ActiveMQTopic

      08:55:53,612 DEBUG [org.jboss.as.deployment.connector] (MSC service thread 1-5) Registering ResourceAdapter activemq-rar-5.4.2

      08:55:53,613 DEBUG [org.jboss.as.connector.deployers.RADeployer] (MSC service thread 1-5) Activated: file:/C:/CWS/jboss-as-7.1.0.Alpha2-SNAPSHOT/standalone/tmp/vfs/tempc4a26ee87bf31f4e/activemq-rar-5.4.2.rar-aa5c9a0956375817/contents/

      08:55:53,620 INFO  [org.jboss.as.connector.deployers.RaXmlDeployer] (MSC service thread 1-6) IJ020001: Required license terms for file:/C:/CWS/jboss-as-7.1.0.Alpha2-SNAPSHOT/standalone/tmp/vfs/tempc4a26ee87bf31f4e/activemq-rar-5.4.2.rar-aa5c9a0956375817/contents/

      08:55:53,801 ERROR [stderr] (MSC service thread 1-6) log4j:WARN No appenders could be found for logger (org.apache.activemq.ra.ActiveMQResourceAdapter).

       

      08:55:53,802 ERROR [stderr] (MSC service thread 1-6) log4j:WARN Please initialize the log4j system properly.

       

      08:55:53,806 DEBUG [org.jboss.tm.usertx.UserTransactionRegistry] (MSC service thread 1-6) org.jboss.tm.usertx.UserTransactionRegistry@d0726d addListener org.jboss.jca.core.tx.jbossts.UserTransactionListenerImpl@114a41

      08:55:53,809 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-6) JBAS010406: Registered connection factory java:/eis/activemq

      08:55:53,813 DEBUG [org.jboss.tm.usertx.UserTransactionRegistry] (MSC service thread 1-6) org.jboss.tm.usertx.UserTransactionRegistry@d0726d addListener org.jboss.jca.core.tx.jbossts.UserTransactionListenerImpl@e62a39

      08:55:53,814 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-6) JBAS010406: Registered connection factory java:/eis/activemq3

      08:55:53,817 DEBUG [org.jboss.tm.usertx.UserTransactionRegistry] (MSC service thread 1-6) org.jboss.tm.usertx.UserTransactionRegistry@d0726d addListener org.jboss.jca.core.tx.jbossts.UserTransactionListenerImpl@1e4e6db

      08:55:53,818 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-6) JBAS010406: Registered connection factory java:/eis/activemq2

      08:55:53,823 DEBUG [org.jboss.tm.usertx.UserTransactionRegistry] (MSC service thread 1-6) org.jboss.tm.usertx.UserTransactionRegistry@d0726d addListener org.jboss.jca.core.tx.jbossts.UserTransactionListenerImpl@15f1ace

      08:55:53,824 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-6) JBAS010406: Registered connection factory java:/eis/activemq

      08:55:53,848 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.ra.deployment."activemq-rar-5.4.2_1": org.jboss.msc.service.StartException in service jboss.ra.deployment."activemq-rar-5.4.2_1": org.jboss.msc.service.StartException in anonymous service: Failed to start RA deployment [activemq-rar-5.4.2]

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

      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_27]

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

      at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]

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

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

      ... 5 more

      Caused by: org.jboss.jca.deployers.common.DeployException: IJ020056: Deployment failed: file:/C:/CWS/jboss-as-7.1.0.Alpha2-SNAPSHOT/standalone/tmp/vfs/tempc4a26ee87bf31f4e/activemq-rar-5.4.2.rar-aa5c9a0956375817/contents/

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

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

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

      ... 5 more

      Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.connector.connection-factory.java:/eis/activemq 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

       

      08:55:53,870 DEBUG [org.jboss.as.deployment.connector] (MSC service thread 1-8) Removed JCA ConnectionFactory [java:/eis/activemq]

      08:55:53,871 DEBUG [org.jboss.as.deployment.connector] (MSC service thread 1-3) Removed JCA ConnectionFactory [java:/eis/activemq3]

      08:55:53,870 DEBUG [org.jboss.as.deployment.connector] (MSC service thread 1-4) Removed JCA ConnectionFactory [java:/eis/activemq2]

      08:55:53,876 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "activemq-rar-5.4.2.rar" was rolled back with failure message {"Failed services" => {"jboss.ra.deployment.\"activemq-rar-5.4.2_1\"" => "org.jboss.msc.service.StartException in service jboss.ra.deployment.\"activemq-rar-5.4.2_1\": org.jboss.msc.service.StartException in anonymous service: Failed to start RA deployment [activemq-rar-5.4.2]"}}

      08:55:53,883 DEBUG [org.jboss.as.deployment.connector] (MSC service thread 1-4) Stopping sevice service jboss.ra.deployment."activemq-rar-5.4.2"

      08:55:53,884 DEBUG [org.jboss.as.deployment.connector] (MSC service thread 1-4) Undeploying: activemq-rar-5.4.2

      08:55:54,004 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Stopped deployment activemq-rar-5.4.2.rar in 128ms

      08:55:54,007 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Failed services" => {"jboss.ra.deployment.\"activemq-rar-5.4.2_1\"" => "org.jboss.msc.service.StartException in service jboss.ra.deployment.\"activemq-rar-5.4.2_1\": org.jboss.msc.service.StartException in anonymous service: Failed to start RA deployment [activemq-rar-5.4.2]"}}}}