我已经在 Wildfly 23.0.1 中使用 QPID C++ 客户端 (AMQP) 一段时间了,没有任何问题。 现在我想使用更新版本的 Wildfly (30+) 并发现一个主要问题:QPID 客户端无法获取或将消息放入队列中,并在 Wildfly 日志中发出警告:
standalone.sh[121985]: JAVA_OPTS already set in environment; overriding default settings with values: -Xmx8g
standalone.sh[121985]: =========================================================================
standalone.sh[121985]: JBoss Bootstrap Environment
standalone.sh[121985]: JBOSS_HOME: /opt/wildfly-31.0.0.Final
standalone.sh[121985]: JAVA: java
standalone.sh[121985]: JAVA_OPTS: -Djdk.serialFilter="maxbytes=10485760;maxdepth=128;maxarray=100000;maxrefs=300000" -Xmx8g --add-exports=java.desktop/sun.awt=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.url.ldap=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.url.ldaps=ALL-UNNAMED --add-exports=jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED --add-opens=java.base/com.sun.net.ssl.internal.ssl=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED
standalone.sh[121985]: =========================================================================
standalone.sh[122082]: WARN [org.jboss.as.txn] (ServerService Thread Pool -- 76) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique.
standalone.sh[122082]: WARN [org.wildfly.extension.elytron] (MSC service thread 1-6) WFLYELY00023: KeyStore file '/var/stmq/wildfly-31/configuration/application.keystore' does not exist. Used blank.
standalone.sh[122082]: WARN [org.wildfly.extension.elytron] (MSC service thread 1-6) WFLYELY01084: KeyStore /var/stmq/wildfly-31/configuration/application.keystore not found, it will be auto-generated on first use with a self-signed certificate for host localhost
standalone.sh[122082]: WARN [org.apache.activemq.artemis.core.client] (Thread-110) AMQ212037: Connection failure to /127.0.0.1:39496 has been detected: javax/management/openmbean/CompositeData [code=GENERIC_EXCEPTION]
standalone.sh[122082]: WARN [org.apache.activemq.artemis.core.server] (Thread-110) AMQ222061: Client connection failed, clearing up resources for session 16f2cfc6-da04-11ee-aae6-005056b82d10
standalone.sh[122082]: WARN [org.apache.activemq.artemis.core.server] (Thread-110) AMQ222107: Cleared up resources for session 16f2cfc6-da04-11ee-aae6-005056b82d10
似乎 org.apache.activemq.artemis.client 和 org.apache.activemq.artemis.protocol.amqp 模块缺少 javax.management.openmbean.CompositeData 类依赖项,但 JAVA_OPTS 有 --add-opens=java.management服务器启动时的 /javax.management=ALL-UNNAMED 子句。
消息子系统以简单-无可疑的方式配置:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:16.0">
<server name="amqserver">
<security elytron-domain="ApplicationDomain"/>
<management jmx-enabled="true"/>
<security-setting name="#">
<role name="amqapp" send="true" consume="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" auto-create-addresses="false"/>
<in-vm-connector name="in-vm" server-id="1"/>
<!--<remote-acceptor name="activemq" socket-binding="61616"/>-->
<in-vm-acceptor name="in-vm" server-id="1"/>
<acceptor name="amqp-acceptor" socket-binding="61616" factory-class="org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory">
<param name="protocols" value="AMQP,CORE"/>
<param name="connection-ttl" value="30000"/>
</acceptor>
<jms-queue name="ExpiryQueue" entries="java:/jms/queues/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queues/DLQ"/>
<jms-queue name="AMQP.IN" entries="java:/jms/queues/AMQP.IN"/>
<jms-queue name="AMQP.OUT" entries="java:/jms/queues/AMQP.OUT"/>
<connection-factory name="in-vm" entries="java:/ConnectionFactory" connectors="in-vm"/>
</server>
</subsystem>
编辑 $WILDFLY_HOME/modules/system/layers/base/org/apache/artemis/* 中的任何 module.xml 会出现另一个启动错误:
AMQ224097: Failed to start server: java.lang.NoClassDefFoundError: javax/management/openmbean/CompositeData
我如何将模块 javax.management 添加到 Wildfly 环境中,我应该使用哪个版本?
PS:Wildfly 通过 openjdk 版本“11.0.17”2022-10-18 LTS 运行。
将
<module name="java.management"/>
添加到模块的依赖项 org.apache.activemq.artemis.protocol.amqp
修复了此问题。