2013-05-15 46 views
4

我在設置hornetq-2.3.0.Final jar中名爲嵌入式遠程核心文件夾下的示例中遇到一些麻煩,我試圖在「遠程環境」中使用此兩臺計算機中的示例同樣的局域網,如果我運行這兩個類而不改變任何東西在同一臺計算機「EmbeddedRemotExample.java」運行正常,但由於這個例子缺乏配置文件我不知道如何設置此類來連接到另一臺計算機上運行的服務器。閱讀API,我發現,這是一個有效的代碼:設置HornetQ嵌入式遠程示例

`

 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();` 

但這會產生下一個異常

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)` 

我怎麼能設置這個具體的例子來工作?

在一臺計算機

:org.hornetq.core.example.EmbeddedServer

另一個:org.hornetq.core.example.EmbeddedRemoteExample

回答