我需要发送消息到远程服务器的队列(运行“JBoss MQ”),以便它可以处理消息并对其执行操作。JMS消息到远程服务器
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
是否有任何特殊的事情来连接到远程队列?
为什么这会降低投票率? – Adam 2009-12-11 16:10:43