JMS message to remote server

I need to send a message to the remote server queue ("JBoss MQ" works) so that it can process the message and act on it.

    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");

      

but I get an exception when running the above code: (although I can ping the remote server).

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 

      

Is there anything special about connecting to a remote queue?

0


source to share


2 answers


The IP you are using is not correct: 192.168.1.131.129 has 5 numbers, it should only have 4.



+1


source


I solved the problem by restarting my JBoss server with the following process arguments:

-b 0.0.0.0



JBoss server by default only starts for local connections. by running it with the above arguments, you are asking it to accept remote connections.

+1


source







All Articles