我尝试使用以下线程https://developer.jboss.org/wiki/HowToUseOutOfProcessActiveMQWithWildFly
添加了Wildfly的ActiveMQ资源适配器在我们的例子中,我们不打算用密码提供明文,所以我尝试使用安全子系统,但它抛出以下异常。
standalone.xml
<resource-adapter id="activemq-rar.rar">
<module slot="main" id="org.activemq"/>
<transaction-support>XATransaction</transaction-support>
<config-property name="ServerUrl">
ssl://localhost:61616
</config-property>
<connection-definitions>
<connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ActivemqJms" enabled="true" pool-name="ActivemqJms">
<config-property name="KeyStorePassword">
KeyStorePassword
</config-property>
<config-property name="KeyStoreKeyPassword">
KeyStoreKeyPassword
</config-property>
<config-property name="TrustStore">
C:/ActiveMQ/conf/keystore.p12
</config-property>
<config-property name="TrustStorePassword">
TrustStorePassword
</config-property>
<config-property name="KeyStore">
C:/ActiveMQ/conf/keystore.p12
</config-property>
<xa-pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>150</max-pool-size>
<prefill>false</prefill>
<is-same-rm-override>false</is-same-rm-override>
</xa-pool>
<security>
<security-domain>ActivemqRealm</security-domain>
</security>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/testqueue" use-java-context="true" pool-name="testqueue">
<config-property name="PhysicalName">
testqueue
</config-property>
</admin-object>
<admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/testtopic" use-java-context="true" pool-name="testtopic">
<config-property name="PhysicalName">
testtopic
</config-property>
</admin-object>
</resource-adapter>
<security-domain name="ActivemqRealm" cache-type="default">
<authentication>
<login-module name="ActivemqRealm-lm" code="com.test.EnctryptedLogin" flag="required" module="com.test.crypto">
<module-option name="userName" value="reportserver"/>
<module-option name="password" value="{AES}:SPiIQQAhcW0gDcS3e+1QjfExRCXj4ixA/EPC+bN7PMA="/>
<module-option name="managedConnectionFactoryName" value="jboss.jca:service=TxCM,name=ActivemqJms"/>
</login-module>
</authentication>
</security-domain>
例外:
16:19:58,462 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 68) MSC000001: Failed to start service jboss.ra.deployment."com.ca.pamsc.activemq:main_activemq-rar.rar": org.jboss.msc.service.StartException in service jboss.ra.deployment."com.ca.pamsc.activemq:main_activemq-rar.rar": WFLYJCA0046: Failed to start RA deployment [activemq-rar.rar]
at org.jboss.as.connector.services.resourceadapters.deployment.AbstractResourceAdapterDeploymentService$2.run(AbstractResourceAdapterDeploymentService.java:332)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: org.jboss.jca.deployers.common.DeployException: IJ020056: Deployment failed: file:/C:/Users/Administrator/Desktop/wildfly/wildfly-11.0.0.Final/modules/org/activemq/main/
at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:2064)
at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService$WildFlyRaXmlDeployer.doDeploy(ResourceAdapterXmlDeploymentService.java:173)
at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:116)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException
at org.jboss.msc.value.InjectedValue.getValue(InjectedValue.java:47)
at org.jboss.as.connector.services.resourceadapters.deployment.AbstractResourceAdapterDeploymentService$AbstractWildFlyRaDeployer.getSubjectFactory(AbstractResourceAdapterDeploymentService.java:635)
at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:1666)
... 7 more
16:19:58,509 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]## Heading ##
答案 0 :(得分:0)
我不知道什么是适合您的确切解决方案,但我分享了我的代码,我的工作很好,希望它对您也有帮助,
standalone.xml
<mdb>
<resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
-
<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
<server name="default">
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="DeckQueue" entries="java:/jboss/exported/jms/queue/DeckQueue"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
我也在我的代码中使用以下值,
public static final String DESTINATION = "destination";
public static final String DESTINATION_VALUE = "java:/jboss/exported/jms/queue/DeckQueue";
public static final String DESTINATION_TYPE = "destinationType";
public static final String DESTINATION_TYPE_VALUE = "javax.jms.Queue";
public static final String QUEUE_LOOKUP = "java:/jboss/exported/jms/queue/DeckQueue";
public static final String CONNECTION_FACTORY = "java:jboss/DefaultJMSConnectionFactory";//