我希望能夠將郵件發送到遠程JBoss服務器(JBoss MQ)。將郵件發送到遠程JMS提供程序
我能做到這一點的地方之一,但與遠程一個嘗試當我卡住了。
任何人都可以向我解釋如何做到這一點? 是否有任何特定的步驟?
[我已經試過到目前爲止]
我需要將消息發送到遠程服務器的隊列(運行「的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
是否有任何特殊的事情來連接到遠程隊列?
感謝您的建議。我試過了,無法連接。沒有防火牆,它仍然無法工作。 – Attilah 2009-12-04 10:49:20