我正在尝试使用 Wildfly 26.0.1-Final 和 ActiveMQ“Classic”5.16.4 测试示例 HelloWorld MDB。
在standalone-full.xml
:
<subsystem xmlns="urn:jboss:domain:ee:6.0">
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<concurrent>
<context-services>
<context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/>
</context-services>
<managed-thread-factories>
<managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/>
</managed-thread-factories>
<managed-executor-services>
<managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-termination-period="0" hung-task-threshold="60000" keepalive-time="5000"/>
</managed-executor-services>
<managed-scheduled-executor-services>
<managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-termination-period="0" hung-task-threshold="60000" keepalive-time="3000"/>
</managed-scheduled-executor-services>
</concurrent>
<!-- <default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" jms-connection-factory="java:jboss/DefaultJMSConnectionFactory" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/> -->
<default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
</subsystem>
<mdb>
<resource-adapter-ref resource-adapter-name="activemq-rar-5.16.4.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
<server name="default">
<security elytron-domain="ApplicationDomain"/>
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<statistics enabled="${wildfly.messaging-activemq.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<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" redistribution-d
elay="1000"/>
<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>
<jgroups-broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<jgroups-discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
<subsystem xmlns="urn:jboss:domain:resource-adapters:6.0">
<resource-adapters>
<resource-adapter id="activemq-rar-5.16.4.rar">
<archive>
activemq-rar-5.16.4.rar
</archive>
<transaction-support>XATransaction</transaction-support>
<config-property name="ServerUrl">tcp://localhost:61616?soTimeout=20000&connectionTimeout=10000</config-property>
<config-property name="UserName">admin</config-property>
<config-property name="UseInboundSession">false</config-property>
<config-property name="Password">admin</config-property>
<connection-definitions>
<connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ActiveMQ/QueueConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQ/QueueConnectionFactory" use-ccm="true">
<xa-pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>200</max-pool-size>
</xa-pool>
<timeout>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/HELLOWORLDMDBQueue" enabled="true" use-java-context="true" pool-name="HELLOWORLDMDBQueue">
<config-property name="PhysicalName">HELLOWORLDMDBQueue</config-property>
</admin-object>
<admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/HELLOWORLDMDBTopic" enabled="true" use-java-context="true" pool-name="HELLOWORLDMDBTopic">
<config-property name="PhysicalName">HELLOWORLDMDBTopic</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
</resource-adapters>
</subsystem>
activemq-rar-5.16.4.rar
将文件放入deployments
文件夹后,我开始使用 Wildfly
./standalone.sh --server-config=standalone-full.xml
现在我想试试 helloworld-mdb
@WebServlet("/HelloWorldMDBServletClient")
public class HelloWorldMDBServletClient extends HttpServlet {
private static final long serialVersionUID = -8314035702649252239L;
private static final int MSG_COUNT = 5;
@Resource(mappedName = "java:/ConnectionFactory")
private ConnectionFactory connectionFactory;
import org.jboss.ejb3.annotation.ResourceAdapter;
/**
* <p>
* A simple Message Driven Bean that asynchronously receives and processes the messages that are sent to the topic.
* </p>
*
* @author Serge Pagop (spagop@redhat.com)
*/
@MessageDriven(name = "HelloWorldQTopicMDB", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "java:/queue/HELLOWORLDMDBTopic"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")})
@ResourceAdapter(value="activemq-rar-5.16.4.rar")
public class HelloWorldTopicMDB implements MessageListener {
完成了战争,我正在尝试部署到 Wildfly,但我给出了一个错误:
09:44:53,938 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."helloworld-mdb.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."helloworld-mdb.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "helloworld-mdb.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NullPointerException
at org.jboss.as.naming.deployment.ContextNames.bindInfoFor(ContextNames.java:351)
at org.wildfly.extension.messaging.activemq.deployment.JMSConnectionFactoryDefinitionInjectionSource.getDefaulResourceAdapter(JMSConnectionFactoryDefinitionInjectionSource.java:428)
at org.wildfly.extension.messaging.activemq.deployment.JMSDestinationDefinitionInjectionSource.getResourceValue(JMSDestinationDefinitionInjectionSource.java:137)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:294)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:242)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:246)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:160)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
... 8 more
09:44:53,941 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "helloworld-mdb.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"helloworld-mdb.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"helloworld-mdb.war\"
Caused by: java.lang.NullPointerException"},
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.deployment.unit.\"helloworld-mdb.war\".WeldStartService",
"jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"helloworld-mdb.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager]",
"jboss.deployment.unit.\"helloworld-mdb.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager, jboss.deployment.unit.\"helloworld-mdb.war\".WeldStartService]"
]
}
09:44:53,942 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "helloworld-mdb.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"helloworld-mdb.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"helloworld-mdb.war\"
Caused by: java.lang.NullPointerException"},
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.deployment.unit.\"helloworld-mdb.war\".WeldStartService",
"jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"helloworld-mdb.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager]",
"jboss.deployment.unit.\"helloworld-mdb.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager, jboss.deployment.unit.\"helloworld-mdb.war\".WeldStartService]"
]
}
09:44:53,942 ERROR [org.jboss.as.server] (External Management Request Threads -- 1) WFLYSRV0021: Deploy of deployment "helloworld-mdb.war" was rolled back with the following failure message:
{
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"helloworld-mdb.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"helloworld-mdb.war\"
Caused by: java.lang.NullPointerException"},
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.deployment.unit.\"helloworld-mdb.war\".WeldStartService",
"jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"helloworld-mdb.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager]",
"jboss.deployment.unit.\"helloworld-mdb.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"helloworld-mdb.war\".beanmanager, jboss.deployment.unit.\"helloworld-mdb.war\".WeldStartService]"
]
}