連接工廠用於在VM外發送消息的連接工廠是什麼?更正用於發送遠程JMS消息的ConnectionFactory jboss 7.1.1
我JBOSS /單機/配置/ configuration_full.xml看到兩個工廠:InVmConnectionFactory和RemoteConnectionFactory。
這是唯一可用的工廠嗎?
我的實際配置是:
服務器standalone_full.xml
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<hornetq-server>
...
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<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="netty"/>
</connectors>
<entries>
<entry name="RemoteConnectionFactory"/>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
</subsystem xmlns="urn:jboss:domain:messaging:1.1">
</hornetq-server>
</subsystem xmlns="urn:jboss:domain:messaging:1.1">
REMOTE MASCINE standalone_full.xml
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<hornetq-server>
...
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<jms-connection-factories> same factories as SERVER </jms-connection-factories>
<jms-destinations>
<jms-queue name="remoteQueue">
<entry name="jms/remoteQueue"/>
<entry name="java:jboss/exported/jms/queue/remoteQueue"/>
</jms-queue>
</jms-destinations>
</subsystem xmlns="urn:jboss:domain:messaging:1.1">
</hornetq-server>
</subsystem xmlns="urn:jboss:domain:messaging:1.1">
查找從服務器端,服務器的應用程序。耳朵:
ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("jms/RemoteConnectionFactory");
Destination destination = (Destination) ctx.lookup("jms/queue/remoteQueue");
背景下建立這樣的:
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
properties.put(Context.PROVIDER_URL, "remote://" + messageConnection.getHost() + ":" + messageConnection.getPort());
properties.put(Context.SECURITY_PRINCIPAL, messageConnection.getUsername());
properties.put(Context.SECURITY_CREDENTIALS, messageConnection.getPassword());
Context ctx = new InitialContext(properties);
錯誤,我得到:
Caused by: java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy
Caused by: an exception which occurred:
in field loadBalancingPolicy
in field serverLocator
in object [email protected]
如果我嘗試部署兩個應用程序服務器application.ear和遠程application.ear在同一個jboss(相同的VM),消息工作正常。
當我使用兩個jbosses(在同一個macchine中)時,會發生此問題。
任何人有任何想法?
預先感謝您。
感謝您的回覆Varsha。 RemoteConnectionFactory AS-IS,使用netty連接器不足以連接到遠程macchine/jvm。唯一的辦法似乎是定義你自己的連接工廠,或者改變實際的「netty」配置,配置'connector'和'acceptor'以IP /端口發送/監聽。 – Ermal
在發送同步消息(在臨時隊列中等待回覆)時,在不同的機器中使用兩個jboss時,錯誤仍然存在。另一個好奇是,第一次正確發送消息並正確收到回覆。第二次嘗試發送我接受錯誤。我會改變主要問題的細節。 – Ermal