Hi Denis,
I have configured TcpDiscoverySpi both on the server side and client side.
On the server side, my configuration is as follows:

        <property name="discoverySpi">
                <bean 
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                        <property name="ipFinder">
                                <bean 
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                                         <property name="addresses">
                                                <list>
                                                        
<value>10.120.70.122:47500..47509</value>
                                                        
<value>10.120.89.196:47500..47509</value>

                                                </list>
                                        </property>
                                </bean>
                        </property>
                </bean>
        </property>


On the client side, I am using java to configure the cache, here is the code:

       TcpDiscoveryVmIpFinder  ipFinder = new TcpDiscoveryVmIpFinder(false);

        List<String> addrs = new ArrayList<String>();
        addrs.add(IGNITE_NEW_ADDRESS);
        addrs.add(IGNITE_ADDRESS);
        ipFinder.setAddresses(addrs);


        TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
        discoverySpi.setIpFinder(ipFinder);

       // discoverySpi.setLocalAddress(instanceName);
       // discoverySpi.setLocalPort(47505);
        igniteCCF.setDiscoverySpi(discoverySpi);



        TcpCommunicationSpi commSpi = new TcpCommunicationSpi();

        igniteCCF.setCommunicationSpi(commSpi);



        //create ignite instance
        ignite = Ignition.start(igniteCCF);


But  I still cannot connect to the server. Or I should see, it did connected to 
the server, however, closed without communication.
When I check the server console, I can see the client node joined, but return 
the following error:
         at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
         at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
         at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to start SPI: 
TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, 
reconCnt=10, maxAckTimeout=600000, forceSrvMode=false, 
clientReconnectDisabled=false]
         at 
org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:258)
         at 
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:660)
         at 
org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1505)
         ... 36 more
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to connect to 
cluster, connection failed and failed to reconnect.
         at 
org.apache.ignite.spi.discovery.tcp.ClientImpl$Reconnector.body(ClientImpl.java:1287)
         at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)


also I checked the log, the there are two types of error messages:

1.       
[21:15:30,801][ERROR][grid-time-coordinator-#50%null%][GridClockSyncProcessor] 
Failed to send time sync snapshot to remote node (did not leave grid?) 
[nodeId=de5a1f4c-d051-4dec-97d0-37da943ebd88, msg=GridClockDeltaSnapshotMessage 
[snapVer=GridClockDeltaVersion [ver=55, topVer=30], 
deltas={66198003-510d-4170-8b8f-5316c01f3d58=8740, 
8c38e19b-3aeb-4865-834b-ee6327913980=96665, 
8fb43d92-da97-4be9-8ecd-50c6456d0362=72055, 
2623a147-609e-4e64-97e3-e8a7fc9ccc42=96665, 
109e1f29-6c93-4e77-a6e0-ba09adbc79eb=-3227, 
6cbddaee-3fc9-4132-88ed-19ab1e5195a1=-5236, 
de5a1f4c-d051-4dec-97d0-37da943ebd88=-10946}], err=Failed to send message (node 
may have left the grid or TCP connection cannot be established due to firewall 
issues) [node=TcpDiscoveryNode [id=de5a1f4c-d051-4dec-97d0-37da943ebd88, 
addrs=[0:0:0:0:0:0:0:1, 10.135.66.169, 127.0.0.1], 
sockAddrs=[/0:0:0:0:0:0:0:1:0, /0:0:0:0:0:0:0:1:0, /10.135.66.169:0, 
/127.0.0.1:0], discPort=0, order=30, intOrder=20, 
lastExchangeTime=1469020510684, loc=false, ver=1.5.0#20151229-sha1:f1f8cda2, 
isClient=true], topic=TOPIC_TIME_SYNC, msg=GridClockDeltaSnapshotMessage 
[snapVer=GridClockDeltaVersion [ver=55, topVer=30], 
deltas={66198003-510d-4170-8b8f-5316c01f3d58=8740, 
8c38e19b-3aeb-4865-834b-ee6327913980=96665, 
8fb43d92-da97-4be9-8ecd-50c6456d0362=72055, 
2623a147-609e-4e64-97e3-e8a7fc9ccc42=96665, 
109e1f29-6c93-4e77-a6e0-ba09adbc79eb=-3227, 
6cbddaee-3fc9-4132-88ed-19ab1e5195a1=-5236, 
de5a1f4c-d051-4dec-97d0-37da943ebd88=-10946}], policy=2]]

2.       
[09:00:10,873][ERROR][shmem-communication-acceptor-#40%null%][TcpCommunicationSpi]
 Failed to process incoming shared memory connection: null

Any Idea how to fix it?

Best regards,
Kevin

发件人: Denis Magda [mailto:dma...@gridgain.com]
发送时间: 2016年7月20日 19:40
收件人: user@ignite.apache.org
主题: Re: ignite Connection refused exception

Hi Kevin,

The exception means that the connection was rejected on a remote side (server 
side). Please make sure that discovery SPI ports are opened between the server 
and client and that the client connects to a valid server node (the server node 
must listen for incoming connection in one of the ports specified in client’s 
IP finder configuration).

—
Denis

On Jul 20, 2016, at 12:27 PM, Zhengqingzheng 
<zhengqingzh...@huawei.com<mailto:zhengqingzh...@huawei.com>> wrote:

Hi there,
When using ignite client connect to the server, I always get exceptions like 
this:
[17:22:24,440][ERROR][tcp-client-disco-msg-worker-#4%default%][TcpDiscoverySpi] 
Exception on joining: Connection refused: connect
java.net.ConnectException: Connection refused: connect
         at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
         at 
java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
         at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
         at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
         at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
         at java.net.Socket.connect(Socket.java:589)
         at 
org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.openSocket(TcpDiscoverySpi.java:1266)
         at 
org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.openSocket(TcpDiscoverySpi.java:1241)
         at 
org.apache.ignite.spi.discovery.tcp.ClientImpl.sendJoinRequest(ClientImpl.java:579)
         at 
org.apache.ignite.spi.discovery.tcp.ClientImpl.joinTopology(ClientImpl.java:505)
         at 
org.apache.ignite.spi.discovery.tcp.ClientImpl.access$900(ClientImpl.java:118)
         at 
org.apache.ignite.spi.discovery.tcp.ClientImpl$MessageWorker.tryJoin(ClientImpl.java:1508)
         at 
org.apache.ignite.spi.discovery.tcp.ClientImpl$MessageWorker.body(ClientImpl.java:1327)
         at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
and exceptions like this:

[17:22:48,949][ERROR][main][IgniteKernal%default] Failed to start manager: 
GridManagerAdapter [enabled=true, 
name=o.a.i.i.managers.discovery.GridDiscoveryManager]
class org.apache.ignite.IgniteCheckedException: Failed to start SPI: 
TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, 
reconCnt=10, maxAckTimeout=600000, forceSrvMode=false, 
clientReconnectDisabled=false]
         at 
org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:258)
         at 
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:660)
         at 
org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1505)
         at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:917)
         at 
org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1688)
         at 
org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1547)
         at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1003)
         at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:534)
         at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:515)
         at org.apache.ignite.Ignition.start(Ignition.java:322)
         at 
com.huawei.soa.ignite.util.IgniteMetaUtils.initCache(IgniteMetaUtils.java:964)
         at 
com.huawei.soa.ignite.util.IgniteMetaUtils.init(IgniteMetaUtils.java:327)
         at 
com.huawei.soa.ignite.util.IgniteMetaUtils.<init>(IgniteMetaUtils.java:296)
         at 
com.huawei.soa.ignite.util.IgniteMetaUtils.getInstance(IgniteMetaUtils.java:124)
         at 
com.huawei.soa.ignite.test.IgniteTest.loadProdCache0(IgniteTest.java:1565)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:497)
         at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
         at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
         at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
         at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
         at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
         at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
         at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
         at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
         at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
         at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
         at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
         at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
         at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
         at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
         at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
         at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
         at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to connect to 
cluster, connection failed and failed to reconnect.
         at 
org.apache.ignite.spi.discovery.tcp.ClientImpl$Reconnector.body(ClientImpl.java:1287)
         at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)


anyone knows why this always happened?

Best regards,
Kevin

Reply via email to