WildFly 8.2为远程服务器配置JMS Bridge [英] WildFly 8.2 configure JMS Bridge for remote servers

查看:147
本文介绍了WildFly 8.2为远程服务器配置JMS Bridge的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在wildfly 8.2上配置一个jmsbridge来连接两个远程服务器.

I'm trying to configure a jmsbridge on wildfly 8.2 for connect two remote servers.

第一个服务器将消息放入本地队列JMSBridgeSourceQ中,然后网桥将消息移动到位于server2上的另一个队列JMSBridgeTargetQ中.

The first server put messages in a local queue JMSBridgeSourceQ then the bridge move the messages to the other queue JMSBridgeTargetQ located on server2.

我遵循了以下示例 http: //everything-jboss.blogspot.it/2013/07/remote-jms-messaging-with-hornetq-on.html 来设置standalone-full-ha.xml.

I followed this example http://everything-jboss.blogspot.it/2013/07/remote-jms-messaging-with-hornetq-on.html for setting the standalone-full-ha.xml.

在服务器1(源)上,我有以下消息部分:

on server 1 (source) I have the following messaging section:

<subsystem xmlns="urn:jboss:domain:messaging:2.0">
        <hornetq-server>
            <!-- <security-enabled>false</security-enabled> -->
            <!-- <cluster-password>${jboss.messaging.cluster.password:CHANGE ME!!}</cluster-password> -->
            <cluster-password>********</cluster-password>
            <journal-file-size>102400</journal-file-size>

            <connectors>
                <http-connector name="http-connector" socket-binding="http">
                    <param key="http-upgrade-endpoint" value="http-acceptor"/>
                </http-connector>
                <http-connector name="http-connector-throughput" socket-binding="http">
                    <param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>
                    <param key="batch-delay" value="50"/>
                </http-connector>
                <netty-connector name="netty-remote" socket-binding="messaging-remote"/>
                <in-vm-connector name="in-vm" server-id="0"/>
            </connectors>

            <acceptors>
                <http-acceptor http-listener="default" name="http-acceptor"/>
                <http-acceptor http-listener="default" name="http-acceptor-throughput">
                    <param key="batch-delay" value="50"/>
                    <param key="direct-deliver" value="false"/>
                </http-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0"/>
            </acceptors>

            <broadcast-groups>
                <broadcast-group name="bg-group1">
                    <socket-binding>messaging-group</socket-binding>
                    <connector-ref>
                        http-connector
                    </connector-ref>
                </broadcast-group>
            </broadcast-groups>

            <discovery-groups>
                <discovery-group name="dg-group1">
                    <socket-binding>messaging-group</socket-binding>
                </discovery-group>
            </discovery-groups>

            <cluster-connections>
                <cluster-connection name="my-cluster">
                    <address>jms</address>
                    <connector-ref>http-connector</connector-ref>
                    <discovery-group-ref discovery-group-name="dg-group1"/>
                </cluster-connection>
            </cluster-connections>

            <security-settings>
                <security-setting match="#">
                    <permission type="send" roles="guest"/>
                    <permission type="consume" roles="guest"/>
                    <permission type="createNonDurableQueue" roles="guest"/>
                    <permission type="deleteNonDurableQueue" roles="guest"/>
                </security-setting>
            </security-settings>

            <address-settings>
                <address-setting match="#">
                    <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                    <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                    <max-size-bytes>10485760</max-size-bytes>
                    <page-size-bytes>2097152</page-size-bytes>
                    <message-counter-history-day-limit>10</message-counter-history-day-limit>
                    <redistribution-delay>1000</redistribution-delay>
                </address-setting>
            </address-settings>

            <jms-connection-factories>
                <connection-factory name="InVmConnectionFactory">
                    <connectors>
                        <connector-ref connector-name="in-vm"/>
                    </connectors>
                    <entries>
                        <entry name="java:/ConnectionFactory"/>
                    </entries>
                </connection-factory>
                <connection-factory name="RemoteConnectionFactory">
                    <connectors>
                        <connector-ref connector-name="http-connector"/>
                    </connectors>
                    <entries>
                        <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                    </entries>
                    <ha>true</ha>
                    <block-on-acknowledge>true</block-on-acknowledge>
                    <reconnect-attempts>-1</reconnect-attempts>
                </connection-factory>
                <pooled-connection-factory name="hornetq-ra">
                    <transaction mode="xa"/>
                    <connectors>
                        <connector-ref connector-name="in-vm"/>
                    </connectors>
                    <entries>
                        <entry name="java:/JmsXA"/>
                        <entry name="java:jboss/DefaultJMSConnectionFactory"/>
                    </entries>
                </pooled-connection-factory>
                <pooled-connection-factory name="hornetq-ra-remote">
                    <transaction mode="xa"/>
                    <connectors>
                        <connector-ref connector-name="netty-remote"/>
                    </connectors>
                    <entries>
                        <entry name="java:/RemoteJmsXA"/>
                    </entries>
                </pooled-connection-factory>
            </jms-connection-factories>

            <jms-destinations>
                <jms-queue name="ExpiryQueue">
                    <entry name="java:/jms/queue/ExpiryQueue"/>
                </jms-queue>
                <jms-queue name="DLQ">
                    <entry name="java:/jms/queue/DLQ"/>
                </jms-queue>
                <jms-queue name="LocalServer1Q">
                    <entry name="queue/LocalServer1Q"/>
                    <entry name="java:jboss/exported/jms/queues/LocalServer1Q"/>
                </jms-queue>
                <jms-queue name="JMSBridgeSourceQ">
                    <entry name="queue/JMSBridgeSourceQ"/>
                    <entry name="java:jboss/exported/jms/queues/JMSBridgeSourceQ"/>
                </jms-queue>
            </jms-destinations>
        </hornetq-server>
        <jms-bridge name="simple-jms-bridge">
            <source>
                <connection-factory name="ConnectionFactory"/>
                <destination name="queue/JMSBridgeSourceQ"/>
            </source>
            <target>
                <connection-factory name="jms/RemoteConnectionFactory"/>
                <destination name="jms/queues/JMSBridgeTargetQ"/>
                <user>jmsuser</user>
                <password>******</password>
                <context>
                    <property key="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory"/>
                    <property key="java.naming.provider.url" value="http-remoting://192.168.5.138:8080"/>
                </context>
            </target>
            <quality-of-service>AT_MOST_ONCE</quality-of-service>
            <failure-retry-interval>10000</failure-retry-interval>
            <max-retries>-1</max-retries>
            <max-batch-size>10</max-batch-size>
            <max-batch-time>100</max-batch-time>
        </jms-bridge>
    </subsystem>

并添加出站套接字绑定:

and adding the outbound-socket-binding:

<outbound-socket-binding name="messaging-remote">
        <remote-destination host="192.168.5.138" port="8080"/>
    </outbound-socket-binding>

在server2(目标)上,我仅配置了队列:

On the server2 (target) I configured only the queue:

<subsystem xmlns="urn:jboss:domain:messaging:2.0">
        <hornetq-server>
            <!-- <cluster-password>${jboss.messaging.cluster.password:CHANGE ME!!}</cluster-password> -->
            <cluster-password>*****</cluster-password>
            <journal-file-size>102400</journal-file-size>
            <!-- ### -->
            <security-enabled>true</security-enabled>
            <!-- ### -->
            <connectors>
                <http-connector name="http-connector" socket-binding="http">
                    <param key="http-upgrade-endpoint" value="http-acceptor"/>
                </http-connector>
                <http-connector name="http-connector-throughput" socket-binding="http">
                    <param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>
                    <param key="batch-delay" value="50"/>
                </http-connector>
                <in-vm-connector name="in-vm" server-id="0"/>
            </connectors>
            <acceptors>
                <http-acceptor name="http-acceptor" http-listener="default"/>
                <http-acceptor name="http-acceptor-throughput" http-listener="default">
                    <param key="batch-delay" value="50"/>
                    <param key="direct-deliver" value="false"/>
                </http-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0"/>
            </acceptors>
            <broadcast-groups>
                <broadcast-group name="bg-group1">
                    <socket-binding>messaging-group</socket-binding>
                    <connector-ref>http-connector</connector-ref>
                </broadcast-group>
            </broadcast-groups>
            <discovery-groups>
                <discovery-group name="dg-group1">
                    <socket-binding>messaging-group</socket-binding>
                </discovery-group>
            </discovery-groups>
            <cluster-connections>
                <cluster-connection name="my-cluster">
                    <address>jms</address>
                    <connector-ref>http-connector</connector-ref>
                    <discovery-group-ref discovery-group-name="dg-group1"/>
                </cluster-connection>
            </cluster-connections>
            <security-settings>
                <security-setting match="#">
                    <permission type="send" roles="guest"/>
                    <permission type="consume" roles="guest"/>
                    <permission type="createNonDurableQueue" roles="guest"/>
                    <permission type="deleteNonDurableQueue" roles="guest"/>
                </security-setting>
            </security-settings>
            <address-settings>
                <!--default for catch all-->
                <address-setting match="#">
                    <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                    <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                    <redistribution-delay>1000</redistribution-delay>
                    <max-size-bytes>10485760</max-size-bytes>
                    <page-size-bytes>2097152</page-size-bytes>
                    <message-counter-history-day-limit>10</message-counter-history-day-limit>
                </address-setting>
            </address-settings>
            <jms-connection-factories>
                <connection-factory name="InVmConnectionFactory">
                    <connectors>
                        <connector-ref connector-name="in-vm"/>
                    </connectors>
                    <entries>
                        <entry name="java:/ConnectionFactory"/>
                    </entries>
                </connection-factory>
                <connection-factory name="RemoteConnectionFactory">
                    <connectors>
                        <connector-ref connector-name="http-connector"/>
                    </connectors>
                    <entries>
                        <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                    </entries>
                    <ha>true</ha>
                    <block-on-acknowledge>true</block-on-acknowledge>
                    <reconnect-attempts>-1</reconnect-attempts>
                </connection-factory>
                <pooled-connection-factory name="hornetq-ra">
                    <transaction mode="xa"/>
                    <connectors>
                        <connector-ref connector-name="in-vm"/>
                    </connectors>
                    <entries>
                        <entry name="java:/JmsXA"/>
                        <!-- Global JNDI entry used to provide a default JMS Connection factory to EE application -->
                        <entry name="java:jboss/DefaultJMSConnectionFactory"/>
                    </entries>
                </pooled-connection-factory>
            </jms-connection-factories>
            <jms-destinations>
                <jms-queue name="ExpiryQueue">
                    <entry name="java:/jms/queue/ExpiryQueue"/>
                </jms-queue>
                <jms-queue name="DLQ">
                    <entry name="java:/jms/queue/DLQ"/>
                </jms-queue>
                <!-- ### -->
                <jms-queue name="LocalServer2Q">
                    <entry name="queue/LocalServer2Q"/>
                    <entry name="java:jboss/exported/jms/queues/LocalServer2Q"/>
                </jms-queue>
                <jms-queue name="JMSBridgeTargetQ">
                    <entry name="queue/JMSBridgeTargetQ"/>
                    <entry name="java:jboss/exported/jms/queues/JMSBridgeTargetQ"/>
                </jms-queue>
                <!-- ### -->
            </jms-destinations>
        </hornetq-server>
    </subsystem>

结果是,当我启动server1时,出现以下错误:

The result is that when I start server1 I got the following error:

18:15:53,892 ERROR [org.jboss.remoting.remote.connection] (Remoting "config-based-naming-client-endpoint" I/O-1) JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms
18:15:53,892 WARN  [org.hornetq.jms.server] (pool-4-thread-1) HQ122010: Failed to connect JMS Bridge: javax.naming.AuthenticationException: Failed to connect to any server. Servers tried: [http-remoting://192.168.5.138:8080 (Authentication failed: the server presented no authentication mechanisms)] [Root exception is javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms]
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:238) [jboss-remote-naming-2.0.1.Final.jar:2.0.1.Final]
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149) [jboss-remote-naming-2.0.1.Final.jar:2.0.1.Final]
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:130) [jboss-remote-naming-2.0.1.Final.jar:2.0.1.Final]
at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272) [jboss-remote-naming-2.0.1.Final.jar:2.0.1.Final]
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:87) [jboss-remote-naming-2.0.1.Final.jar:2.0.1.Final]
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:129) [jboss-remote-naming-2.0.1.Final.jar:2.0.1.Final]
at javax.naming.InitialContext.lookup(Unknown Source) [rt.jar:1.7.0_75]
at javax.naming.InitialContext.lookup(Unknown Source) [rt.jar:1.7.0_75]
at org.hornetq.jms.bridge.impl.JNDIFactorySupport.createObject(JNDIFactorySupport.java:56) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.bridge.impl.JNDIDestinationFactory.createDestination(JNDIDestinationFactory.java:38) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1233) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjectsWithRetry(JMSBridgeImpl.java:1471) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.bridge.impl.JMSBridgeImpl.access$2200(JMSBridgeImpl.java:76) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.bridge.impl.JMSBridgeImpl$FailureHandler.run(JMSBridgeImpl.java:2079) [hornetq-jms-server-2.4.5.Final.jar:]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_75]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_75]
Caused by: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:388)
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:242)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.3.0.Final.jar:3.3.0.Final]
at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:199) [xnio-api-3.3.0.Final.jar:3.3.0.Final]
at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:113) [xnio-api-3.3.0.Final.jar:3.3.0.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.3.0.Final.jar:3.3.0.Final]
at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092) [xnio-api-3.3.0.Final.jar:3.3.0.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.3.0.Final.jar:3.3.0.Final]
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) [xnio-api-3.3.0.Final.jar:3.3.0.Final]
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:539)
at ...asynchronous invocation...(Unknown Source)
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:272)
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:253)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:351)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:335)
at org.jboss.naming.remote.client.EndpointCache$EndpointWrapper.connect(EndpointCache.java:111) [jboss-remote-naming-2.0.1.Final.jar:2.0.1.Final]
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:197) [jboss-remote-naming-2.0.1.Final.jar:2.0.1.Final]
... 16 more

两台服务器上都有一个jmsuser,并且在ApplicationRealm中注册了相同的密码,但是我认为这不是导致此错误的原因.

On both servers there is jmsuser with the same password registered in ApplicationRealm, but I think that it isn't the cause of this error.

感谢您的帮助.

谢谢!

推荐答案

我在WildFly 8.1上遇到了同样的问题.我通过在上下文中添加用户名和密码来解决此问题.

I had the same issue on WildFly 8.1. I resolved this by adding the username and password to the context.

<context>
    <property key="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory"/>
    <property key="java.naming.provider.url" value="http-remoting://example.com:80"/>
    <property key="java.naming.security.principal" value="user"/>
    <property key="java.naming.security.credentials" value="password"/>
</context>

这篇关于WildFly 8.2为远程服务器配置JMS Bridge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆