jms 消息服务器,JMS消息到远程服务器(JMS message to remote server)

我需要将消息发送到远程服务器的队列(运行“的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.1.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

有什么特别做连接到远程队列?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值