Post

2 followers Follow
0
Avatar

Java Client is not able to access gemfire xd server

Hi,

I have set up gemfire xd server but java client is not able to connect to the locator.I am getting below exception:
A communications error has been detected: Failed after trying all available servers: [], for control URL: liaan048-001.isus.emc.com[1527].
at com.pivotal.gemfirexd.internal.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:77)
at com.pivotal.gemfirexd.internal.client.am.SqlException.getSQLException(SqlException.java:401)
at com.pivotal.gemfirexd.internal.client.net.NetConnection.getPreferredServer(NetConnection.java:1509)
at com.pivotal.gemfirexd.internal.client.net.NetConnection.preConnect(NetConnection.java:1857)
at com.pivotal.gemfirexd.internal.client.net.NetConnection.newAgent_(NetConnection.java:2323)
at com.pivotal.gemfirexd.internal.client.am.Connection.<init>(Connection.java:562)
at com.pivotal.gemfirexd.internal.client.net.NetConnection.<init>(NetConnection.java:244)
at com.pivotal.gemfirexd.internal.client.net.NetConnection40.<init>(NetConnection40.java:86)
at com.pivotal.gemfirexd.internal.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(ClientJDBCObjectFactoryImpl40.java:289)
at com.pivotal.gemfirexd.jdbc.ClientDriver.connect(ClientDriver.java:161)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:233)
at com.emc.rabbitpoc.gemfirexd.GemfireXDClient.main(GemfireXDClient.java:21)

arghya sadhu Answered

Please sign in to leave a comment.

9 comments

0
Avatar

Hi, can you try adding -client-bind-address=<ip or hostname of server> to the server and locator (if you are using one) startup with the hostname or ip that the client would use to actually connect to that individual component.

Jens Deppe 0 votes
0
Avatar

Actually I am using below:
gfxd locator start -peer-discovery-address=10.31.74.48 -peer-discovery-port=10101 -dir=locator1 -jmx-manager-start=true -jmx-manager-http-port=7075 -client-bind-address=10.31.74.48 -client-port=1527

gfxd server start -locators=10.31.74.48[10101] -client-bind-address=10.31.74.48 -client-port=1528 -dir=server1
gfxd server start -locators=10.31.74.48[10101] -client-bind-address=10.31.74.48 -client-port=1529 -dir=server2

arghya sadhu 0 votes
0
Avatar

My client code is like below:

public static void main(String []args){
try {
Class.forName("com.pivotal.gemfirexd.jdbc.ClientDriver");
Connection conn =
DriverManager.getConnection("jdbc:gemfirexd://10.31.74.48:1527/");
System.out.println("Connection established");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}

arghya sadhu 0 votes
0
Avatar

Your startup options appear to be OK. It may be some DNS address resolution problem. Is the system, on which you are running the client, able to resolve liaan048-001.isus.emc.com?

Try using gfxd to make a connection:

gfxd> connect client '10.31.74.48[1527]';

You may get an UnknownHostException. If that happens, add the following to the startup of the locator and servers:

-J-Dgemfirexd.prefer-netserver-ipaddress=true

And then try connecting with gfxd again.

Jens Deppe 0 votes
0
Avatar

I am running the client from STS in my windows system which does not have gemfire XD installed(I guess gemfire XD can not be installed on windows).So I can not run gfxd from my client machine and perform the suggestion you have given.

arghya sadhu 0 votes
1
Avatar

It seems that your cluster may not have been fully formed. In your initial message, there should have been a longer list of 'all available servers'.

Can you examine your server logs for messages similar to:

[info 2014/07/17 10:18:51.211 PDT <PingSender> tid=0x21] locator pdx2-office-dhcp18()<v0>:10101 member address is pdx2-office-dhcp18(41450)<v0>:31829

This will show whether the server can find the locator. Then in the locator log, look for messages such as these:

[info 2014/07/17 10:18:51.372 PDT <ViewHandler> tid=0x3d] Membership: sending new view [pdx2-office-dhcp18(41450)<v0>:31829|1] [pdx2-office-dhcp18(41450)<v0>:31829/52768, pdx2-office-dhcp18(41468)<v1>:47035/7174]

[info 2014/07/17 10:18:51.380 PDT <View Message Processor> tid=0x3f] Admitting member <pdx2-office-dhcp18(41468)<v1>:47035>. Now there are 2 non-admin member(s).

These will show that the servers have joined the cluster successfully.

Also try using gfxd from the system running the cluster and try and connect to it. Once connected, run the following to check that all members are present:

select id, kind, status, ipaddress, host, netservers from sys.members;

Please send the output from that command.

Jens Deppe 1 vote
1
Avatar

gfxd> select id, kind, netservers from sys.members;

ID |KIND |NETSERVERS
liaan048-001(26450)<v1>:45092 |datastore(normal) |10.31.74.48/10.31.74.48[1528]
liaan048-001(26569)<v2>:58039 |datastore(normal) |10.31.74.48/10.31.74.48[1529]
liaan048-001(26334)<v0>:21686 |locator(normal) |10.31.74.48/10.31.74.48[1527]

3 rows selected

and Now I am able to execute the client java program after modifying the iptables to open the ports 1527,1528,1529
and I get below output:

Connection established

arghya sadhu 1 vote