我正嘗試在遠程服務器上使用Infinispan遠程緩存。我正在使用 Java應用程序連接到服務器並將對象存儲在內存中。Infinispan Hotrod遠程服務器異常
當我運行本地hotrod服務器使用環回地址 (127.0.0.1)這個應用程序的工作。但是,當我嘗試將它用於遠程服務器時,它會失敗。
這裏是代碼片段:
進口org.infinispan.client.hotrod.RemoteCache; import org.infinispan.client.hotrod.RemoteCacheManager;
public class HotRodRemoteClient {
public void start() {
RemoteCacheManager manager = new RemoteCacheManager("10.100.9.28");
RemoteCache<Integer, Ticket> cache = manager.getCache();
}
}
這裏是個例外:
ISPN004017: Could not fetch transport
org.infinispan.client.hotrod.exceptions.TransportException:: Could not connect to server: /10.100.9.28:11222
at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport.<init>(TcpTransport.java:90)
at org.infinispan.client.hotrod.impl.transport.tcp.TransportObjectFactory.makeObject(TransportObjectFactory.java:57)
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1220)
at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory.borrowTransportFromPool(TcpTransportFactory.java:254)
at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory.getTransport(TcpTransportFactory.java:145)
at org.infinispan.client.hotrod.impl.operations.FaultTolerantPingOperation.getTransport(FaultTolerantPingOperation.java:44)
at org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation.execute(RetryOnFailureOperation.java:67)
at org.infinispan.client.hotrod.impl.RemoteCacheImpl.ping(RemoteCacheImpl.java:432)
at org.infinispan.client.hotrod.RemoteCacheManager.ping(RemoteCacheManager.java:538)
at org.infinispan.client.hotrod.RemoteCacheManager.createRemoteCache(RemoteCacheManager.java:520)
at org.infinispan.client.hotrod.RemoteCacheManager.getCache(RemoteCacheManager.java:452)
at org.infinispan.client.hotrod.RemoteCacheManager.getCache(RemoteCacheManager.java:447)
at com.packtpub.infinispan.chapter2.HotRodRemoteClient.start(HotRodRemoteClient.java:17)
at com.packtpub.infinispan.chapter2.HotRodRemoteClient.main(HotRodRemoteClient.java:65)
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:100)
at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport.<init>(TcpTransport.java:81)
... 13 more
我可以ping服務器10.100.9.28:
shell> ping 10.100.9.28
PING 10.100.9.28 (10.100.9.28): 56 data bytes
64 bytes from 10.100.9.28: icmp_seq=0 ttl=64 time=0.261 ms
64 bytes from 10.100.9.28: icmp_seq=1 ttl=64 time=0.184 ms
64 bytes from 10.100.9.28: icmp_seq=2 ttl=64 time=0.290 ms
64 bytes from 10.100.9.28: icmp_seq=3 ttl=64 time=0.285 ms
我用的Infinispan 5.1.6,Maven的3.04,JDK6.33。
我的Hotrod服務器在CentOS 5.5上運行,但Java應用程序在Mac 10.7
防火牆在兩臺機器上被禁用。
我懷疑這是配置問題。我應該改變什麼才能使其發揮作用?
謝謝
雅各Nikom
你能 「netstat的-apn --ip」 在服務器上運行,並尋求在端口11222的綁定? –