【发布时间】:2009-12-15 23:08:06
【问题描述】:
我希望能够将消息发送到远程 JBoss 服务器 (JBoss MQ)。
我可以为本地人做,但在尝试远程人时我被卡住了。
谁能给我解释一下怎么做? 有什么具体的步骤吗?
[到目前为止我尝试过的]
我需要向远程服务器的队列(运行“JBoss MQ”)发送消息,以便它可以处理消息并对其采取行动。
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
properties.put(Context.PROVIDER_URL, "jnp://192.168.131.129:1299");
InitialContext jndiContext = new InitialContext(properties);
//[2] Look up connection factory and queue.
ConnectionFactory connectionFactory = (ConnectionFactory)jndiContext.lookup("UIL2XAConnectionFactory");
Queue queue = (Queue)jndiContext.lookup("Queue/DataTransferQueue");
但在运行上述代码时出现异常: (尽管如此,我可以 ping 远程服务器)。
javax.naming.CommunicationException: Could not obtain connection to any of these urls: 192.168.1.131.129:1299 and
discovery failed with error: javax.naming.CommunicationException:
Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
[Root exception is javax.naming.CommunicationException: Failed to connect to server 192.168.1.131.129:1299
连接远程队列有什么特别的吗?
【问题讨论】: