ActiveMQ 不在 Wildfly 上使用 jboss.bind.address
ActiveMQ doesn't use jboss.bind.address on Wildfly
我正在尝试设置一个具有两个节点的简单集群,我的应用程序使用 JMS。
我尝试使用以下命令启动节点:
standalone.bat --server-config=standalone-full-ha.xml -Djboss.server.base.dir=C:\scope-na\e-commerce\wildfly-11.0.0.Final\standalone_no2 -Djboss.bind.address=10.50.17.211 -Djboss.node.name=ecommerce_02
服务器启动时出现此警告:
2019-09-25 18:56:14,305 WARN [org.apache.activemq.artemis.jms.server] (ServerService Thread Pool -- 79) AMQ122005: Invalid "host" value "0.0.0.0" detected for "http-connector" connector. Switching to "Matriz_IPxxx_Win2012R2_Sql". If this new address is incorrect please manually configure the connector to use the proper one.
然后我遇到了很多这样的错误:
2019-09-25 18:35:59,937 ERROR [org.apache.activemq.artemis.core.client] (Thread-7 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl@d82718b)) AMQ214016: Failed to create netty connection: java.net.URISyntaxException: Illegal character in hostname at index 13: http://Matriz_IPxxx_Win2012R2_Sql:8080
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.parseHostname(URI.java:3387)
at java.net.URI$Parser.parseServer(URI.java:3236)
at java.net.URI$Parser.parseAuthority(URI.java:3155)
at java.net.URI$Parser.parseHierarchical(URI.java:3097)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:673)
at org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector.createConnection(NettyConnector.java:663)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.openTransportConnection(ClientSessionFactoryImpl.java:1036)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createTransportConnection(ClientSessionFactoryImpl.java:1076)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.establishNewConnection(ClientSessionFactoryImpl.java:1254)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:891)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:795)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:238)
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:685)
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:659)
at org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionBridge.createSessionFactory(ClusterConnectionBridge.java:136)
at org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl.connect(BridgeImpl.java:863)
at org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl$ConnectRunnable.run(BridgeImpl.java:1054)
at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:122)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
我尝试使用 -b 绑定地址并使用系统属性:
<system-properties>
<property name="jboss.socket.binding.port-offset" value="10"/>
<property name="jboss.node.name" value="ecommerce_02"/>
<property name="jboss.bind.address" value="10.50.17.211"/>
<property name="jboss.bind.address.private" value="10.50.17.211"/>
<property name="jboss.bind.address.unsecure" value="10.50.17.211"/>
<property name="jboss.bind.address.management" value="10.50.17.211"/>
</system-properties>
相关配置详情如下...
messaging-activemq 子系统:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<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-delay="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>
<broadcast-group name="bg-group1" jgroups-channel="activemq-cluster" connectors="http-connector"/>
<discovery-group name="dg-group1" jgroups-channel="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"/>
<jms-queue name="TabelaMensagens" entries="java:/jms/queue/TabelaMensagens"/>
<jms-queue name="SendGateway" entries="java:/jms/queue/SendGateway"/>
<jms-queue name="TransacaoAProcessar" entries="java:/jms/queue/TransacaoAProcessar"/>
<jms-queue name="TransacaoProcessada" entries="java:/jms/queue/TransacaoProcessada"/>
<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>
套接字绑定组
<socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="iiop" interface="unsecure" port="3528"/>
<socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>
<socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
<socket-binding name="jgroups-tcp" interface="private" port="7600"/>
<socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
<socket-binding name="modcluster" port="0" multicast-address="${jboss.modcluster.multicast.address:224.0.1.105}" multicast-port="23364"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
接口
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="private">
<inet-address value="${jboss.bind.address.private:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
<interface name="any">
<any-address/>
</interface>
</interfaces>
我认为问题是由于 socket-binding-group
的 default-interface
是 any
而 any
接口定义如下:
<interface name="any">
<any-address/>
</interface>
这意味着任何未明确配置其 interface
的 socket-binding
将使用 any
接口。这包括 Artemis 使用的 http
socket-binding
。 any
interface
而不是 使用您为将服务器绑定到特定接口而定义的任何系统属性。相反,它将使用 0.0.0.0
,这对 Artemis 配置来说是有问题的(如日志中所述)。我建议您在 socket-binding-group
.
中设置 default-interface="public"
我正在尝试设置一个具有两个节点的简单集群,我的应用程序使用 JMS。
我尝试使用以下命令启动节点:
standalone.bat --server-config=standalone-full-ha.xml -Djboss.server.base.dir=C:\scope-na\e-commerce\wildfly-11.0.0.Final\standalone_no2 -Djboss.bind.address=10.50.17.211 -Djboss.node.name=ecommerce_02
服务器启动时出现此警告:
2019-09-25 18:56:14,305 WARN [org.apache.activemq.artemis.jms.server] (ServerService Thread Pool -- 79) AMQ122005: Invalid "host" value "0.0.0.0" detected for "http-connector" connector. Switching to "Matriz_IPxxx_Win2012R2_Sql". If this new address is incorrect please manually configure the connector to use the proper one.
然后我遇到了很多这样的错误:
2019-09-25 18:35:59,937 ERROR [org.apache.activemq.artemis.core.client] (Thread-7 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl@d82718b)) AMQ214016: Failed to create netty connection: java.net.URISyntaxException: Illegal character in hostname at index 13: http://Matriz_IPxxx_Win2012R2_Sql:8080
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.parseHostname(URI.java:3387)
at java.net.URI$Parser.parseServer(URI.java:3236)
at java.net.URI$Parser.parseAuthority(URI.java:3155)
at java.net.URI$Parser.parseHierarchical(URI.java:3097)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:673)
at org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector.createConnection(NettyConnector.java:663)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.openTransportConnection(ClientSessionFactoryImpl.java:1036)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createTransportConnection(ClientSessionFactoryImpl.java:1076)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.establishNewConnection(ClientSessionFactoryImpl.java:1254)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:891)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:795)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:238)
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:685)
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:659)
at org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionBridge.createSessionFactory(ClusterConnectionBridge.java:136)
at org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl.connect(BridgeImpl.java:863)
at org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl$ConnectRunnable.run(BridgeImpl.java:1054)
at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:122)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
我尝试使用 -b 绑定地址并使用系统属性:
<system-properties>
<property name="jboss.socket.binding.port-offset" value="10"/>
<property name="jboss.node.name" value="ecommerce_02"/>
<property name="jboss.bind.address" value="10.50.17.211"/>
<property name="jboss.bind.address.private" value="10.50.17.211"/>
<property name="jboss.bind.address.unsecure" value="10.50.17.211"/>
<property name="jboss.bind.address.management" value="10.50.17.211"/>
</system-properties>
相关配置详情如下...
messaging-activemq 子系统:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<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-delay="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>
<broadcast-group name="bg-group1" jgroups-channel="activemq-cluster" connectors="http-connector"/>
<discovery-group name="dg-group1" jgroups-channel="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"/>
<jms-queue name="TabelaMensagens" entries="java:/jms/queue/TabelaMensagens"/>
<jms-queue name="SendGateway" entries="java:/jms/queue/SendGateway"/>
<jms-queue name="TransacaoAProcessar" entries="java:/jms/queue/TransacaoAProcessar"/>
<jms-queue name="TransacaoProcessada" entries="java:/jms/queue/TransacaoProcessada"/>
<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>
套接字绑定组
<socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="iiop" interface="unsecure" port="3528"/>
<socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>
<socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
<socket-binding name="jgroups-tcp" interface="private" port="7600"/>
<socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
<socket-binding name="modcluster" port="0" multicast-address="${jboss.modcluster.multicast.address:224.0.1.105}" multicast-port="23364"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
接口
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="private">
<inet-address value="${jboss.bind.address.private:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
<interface name="any">
<any-address/>
</interface>
</interfaces>
我认为问题是由于 socket-binding-group
的 default-interface
是 any
而 any
接口定义如下:
<interface name="any">
<any-address/>
</interface>
这意味着任何未明确配置其 interface
的 socket-binding
将使用 any
接口。这包括 Artemis 使用的 http
socket-binding
。 any
interface
而不是 使用您为将服务器绑定到特定接口而定义的任何系统属性。相反,它将使用 0.0.0.0
,这对 Artemis 配置来说是有问题的(如日志中所述)。我建议您在 socket-binding-group
.
default-interface="public"