DguezTorresEmmanuel
DguezTorresEmmanuel

Reputation: 358

Setting the HornetQ Embedded-Remote Example

I am having some troubles setting the example in the hornetq-2.3.0.Final jar under the core folder named Embedded-Remote, I am trying to run the example in a "remote enviroment" using for this two computers in the same LAN, if i run the two classes without changing anything in the same computer "EmbeddedRemotExample.java" runs ok, but as this example lacks configuration files I am not sure about how to set this class to connect to a server running in another computer. reading the api I found that this was a valid code:

`

     HashMap map = new HashMap();
     map.put("host", "192.168.XXX.XXX");
     map.put("port", 5445);
     ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(
         new TransportConfiguration(NettyConnectorFactory.class.getName(),map));
     ClientSessionFactory sf = serverLocator.createSessionFactory();` 

but this produces the next exception

HornetQException[errorType=NOT_CONNECTED message=HQ119007: Cannot connect to server(s). Tried with all available servers.]
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:852)
at org.hornetq.core.example.EmbeddedRemoteExample.main(EmbeddedRemoteExample.java:49)`

How could i set this specific example to work?

in one computer : org.hornetq.core.example.EmbeddedServer

in other one : org.hornetq.core.example.EmbeddedRemoteExample

Upvotes: 4

Views: 3527

Answers (1)

Francisco
Francisco

Reputation: 4110

You need to add the same configuration to the server's Acceptor at EmbeddedServer.java. As by default it would be set to localhost.

I reckon that that example needs a code clean-up:

https://github.com/hornetq/hornetq/pull/1062

This specific commit would make clear what you need to change:

https://github.com/FranciscoBorges/hornetq/commit/fbed7e8394c843e4528df90d4c2ef155a7d032c0

Upvotes: 5

Related Questions