I have start embedded apache drill instance following this tutorial https://drill.apache.org/docs/using-the-jdbc-driver/ I can query drill from console. But now I need to connect it from my code.
Connection conn = null;
conn = DriverManager.getConnection("jdbc:drill:zk=localhost:31010");
When I run it I get following output in my IDE:
18:01:04.970 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:31010. Will not attempt to authenticate using SASL (unknown error)
18:01:04.970 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established to localhost/0:0:0:0:0:0:0:1:31010, initiating session
18:01:04.971 [main-SendThread(localhost:31010)] DEBUG org.apache.zookeeper.ClientCnxn - Session establishment request sent on localhost/0:0:0:0:0:0:0:1:31010
18:01:04.972 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
18:01:05.331 [main] DEBUG org.apache.curator.RetryLoop - Retrying operation
18:01:06.721 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server localhost/127.0.0.1:31010. Will not attempt to authenticate using SASL (unknown error)
18:01:06.721 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established to localhost/127.0.0.1:31010, initiating session
18:01:06.721 [main-SendThread(localhost:31010)] DEBUG org.apache.zookeeper.ClientCnxn - Session establishment request sent on localhost/127.0.0.1:31010
18:01:06.722 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
18:01:07.495 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:31010. Will not attempt to authenticate using SASL (unknown error)
18:01:07.495 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established to localhost/0:0:0:0:0:0:0:1:31010, initiating session
18:01:07.495 [main-SendThread(localhost:31010)] DEBUG org.apache.zookeeper.ClientCnxn - Session establishment request sent on localhost/0:0:0:0:0:0:0:1:31010
18:01:07.496 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
18:01:09.269 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server localhost/127.0.0.1:31010. Will not attempt to authenticate using SASL (unknown error)
18:01:09.269 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established to localhost/127.0.0.1:31010, initiating session
18:01:09.269 [main-SendThread(localhost:31010)] DEBUG org.apache.zookeeper.ClientCnxn - Session establishment request sent on localhost/127.0.0.1:31010
18:01:09.270 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
18:01:09.392 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:31010. Will not attempt to authenticate using SASL (unknown error)
18:01:09.392 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established to localhost/0:0:0:0:0:0:0:1:31010, initiating session
18:01:09.392 [main-SendThread(localhost:31010)] DEBUG org.apache.zookeeper.ClientCnxn - Session establishment request sent on localhost/0:0:0:0:0:0:0:1:31010
18:01:09.393 [main-SendThread(localhost:31010)] INFO org.apache.zookeeper.ClientCnxn - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
18:01:10.355 [main] ERROR org.apache.curator.ConnectionState - Connection timed out for connection string (localhost:31010) and timeout (5000) / elapsed (6199)
org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLoss
at org.apache.curator.ConnectionState.checkTimeouts(ConnectionState.java:198) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.ConnectionState.getZooKeeper(ConnectionState.java:88) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:115) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.utils.EnsurePath$InitialHelper$1.call(EnsurePath.java:148) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.utils.EnsurePath$InitialHelper.ensure(EnsurePath.java:140) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.utils.EnsurePath.ensure(EnsurePath.java:99) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.imps.NamespaceImpl.fixForNamespace(NamespaceImpl.java:74) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.imps.NamespaceImpl.newNamespaceAwareEnsurePath(NamespaceImpl.java:87) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.imps.CuratorFrameworkImpl.newNamespaceAwareEnsurePath(CuratorFrameworkImpl.java:468) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.recipes.cache.PathChildrenCache.<init>(PathChildrenCache.java:223) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.recipes.cache.PathChildrenCache.<init>(PathChildrenCache.java:182) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.x.discovery.details.ServiceCacheImpl.<init>(ServiceCacheImpl.java:65) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.x.discovery.details.ServiceCacheBuilderImpl.build(ServiceCacheBuilderImpl.java:47) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.drill.exec.coord.zk.ZKClusterCoordinator.<init>(ZKClusterCoordinator.java:104) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.drill.exec.client.DrillClient.connect(DrillClient.java:185) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.drill.jdbc.DrillConnectionImpl.<init>(DrillConnectionImpl.java:126) [drill-jdbc-1.0.0.jar:1.0.0]
at org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection.<init>(DrillJdbc41Factory.java:97) [drill-jdbc-1.0.0.jar:1.0.0]
at org.apache.drill.jdbc.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:60) [drill-jdbc-1.0.0.jar:1.0.0]
at org.apache.drill.jdbc.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:46) [drill-jdbc-1.0.0.jar:1.0.0]
at org.apache.drill.jdbc.DrillFactory.newConnection(DrillFactory.java:54) [drill-jdbc-1.0.0.jar:1.0.0]
at net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:126) [drill-jdbc-all-1.0.0.jar:na]
at java.sql.DriverManager.getConnection(DriverManager.java:571) [na:1.7.0_67]
at java.sql.DriverManager.getConnection(DriverManager.java:233) [na:1.7.0_67]
at DrillConnectTest.testConnect(DrillConnectTest.java:34) [classes/:na]
at DrillConnectTest.main(DrillConnectTest.java:55) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_67]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) [idea_rt.jar:na]
18:01:10.355 [main] DEBUG org.apache.curator.RetryLoop - Retry-able exception received
org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLoss
at org.apache.curator.ConnectionState.checkTimeouts(ConnectionState.java:198) ~[drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.ConnectionState.getZooKeeper(ConnectionState.java:88) ~[drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:115) ~[drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.utils.EnsurePath$InitialHelper$1.call(EnsurePath.java:148) ~[drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107) ~[drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.utils.EnsurePath$InitialHelper.ensure(EnsurePath.java:140) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.utils.EnsurePath.ensure(EnsurePath.java:99) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.imps.NamespaceImpl.fixForNamespace(NamespaceImpl.java:74) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.imps.NamespaceImpl.newNamespaceAwareEnsurePath(NamespaceImpl.java:87) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.imps.CuratorFrameworkImpl.newNamespaceAwareEnsurePath(CuratorFrameworkImpl.java:468) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.recipes.cache.PathChildrenCache.<init>(PathChildrenCache.java:223) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.framework.recipes.cache.PathChildrenCache.<init>(PathChildrenCache.java:182) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.x.discovery.details.ServiceCacheImpl.<init>(ServiceCacheImpl.java:65) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.curator.x.discovery.details.ServiceCacheBuilderImpl.build(ServiceCacheBuilderImpl.java:47) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.drill.exec.coord.zk.ZKClusterCoordinator.<init>(ZKClusterCoordinator.java:104) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.drill.exec.client.DrillClient.connect(DrillClient.java:185) [drill-jdbc-all-1.0.0.jar:na]
at org.apache.drill.jdbc.DrillConnectionImpl.<init>(DrillConnectionImpl.java:126) [drill-jdbc-1.0.0.jar:1.0.0]
at org.apache.drill.jdbc.DrillJdbc41Factory$DrillJdbc41Connection.<init>(DrillJdbc41Factory.java:97) [drill-jdbc-1.0.0.jar:1.0.0]
at org.apache.drill.jdbc.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:60) [drill-jdbc-1.0.0.jar:1.0.0]
at org.apache.drill.jdbc.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:46) [drill-jdbc-1.0.0.jar:1.0.0]
at org.apache.drill.jdbc.DrillFactory.newConnection(DrillFactory.java:54) [drill-jdbc-1.0.0.jar:1.0.0]
at net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:126) [drill-jdbc-all-1.0.0.jar:na]
at java.sql.DriverManager.getConnection(DriverManager.java:571) [na:1.7.0_67]
at java.sql.DriverManager.getConnection(DriverManager.java:233) [na:1.7.0_67]
at DrillConnectTest.testConnect(DrillConnectTest.java:34) [classes/:na]
at DrillConnectTest.main(DrillConnectTest.java:55) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_67]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) [idea_rt.jar:na]
18:01:10.860 [main] DEBUG org.apache.curator.RetryLoop - Retrying operation
And this repeats in cycle. And in server logs also I see following:
2015-06-22 17:53:20,465 [UserServer-1] INFO o.a.d.exec.rpc.ProtobufLengthDecoder - Channel is closed, discarding remaining 48 byte(s) in buffer.
2015-06-22 17:53:21,232 [UserServer-1] ERROR o.a.d.exec.rpc.RpcExceptionHandler - Exception in RPC communication. Connection: /127.0.0.1:31010 <--> /127.0.0.1:55704 (user client). Closing connection.
io.netty.handler.codec.CorruptedFrameException: Received a message of length 0.
at org.apache.drill.exec.rpc.ProtobufLengthDecoder.decode(ProtobufLengthDecoder.java:74) ~[drill-java-exec-1.0.0-rebuffed.jar:1.0.0]
at org.apache.drill.exec.rpc.user.UserProtobufLengthDecoder.decode(UserProtobufLengthDecoder.java:37) ~[drill-java-exec-1.0.0-rebuffed.jar:1.0.0]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:315) ~[netty-codec-4.0.27.Final.jar:4.0.27.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:229) ~[netty-codec-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) [netty-common-4.0.27.Final.jar:4.0.27.Final]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
2015-06-22 17:53:21,232 [UserServer-1] INFO o.a.d.exec.rpc.ProtobufLengthDecoder - Channel is closed, discarding remaining 48 byte(s) in buffer.
2015-06-22 17:53:23,324 [UserServer-1] ERROR o.a.d.exec.rpc.RpcExceptionHandler - Exception in RPC communication. Connection: /0:0:0:0:0:0:0:1:31010 <--> /0:0:0:0:0:0:0:1:55706 (user client). Closing connection.
io.netty.handler.codec.CorruptedFrameException: Received a message of length 0.
at org.apache.drill.exec.rpc.ProtobufLengthDecoder.decode(ProtobufLengthDecoder.java:74) ~[drill-java-exec-1.0.0-rebuffed.jar:1.0.0]
at org.apache.drill.exec.rpc.user.UserProtobufLengthDecoder.decode(UserProtobufLengthDecoder.java:37) ~[drill-java-exec-1.0.0-rebuffed.jar:1.0.0]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:315) ~[netty-codec-4.0.27.Final.jar:4.0.27.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:229) ~[netty-codec-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) [netty-common-4.0.27.Final.jar:4.0.27.Final]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
2015-06-22 17:53:23,325 [UserServer-1] INFO o.a.d.exec.rpc.ProtobufLengthDecoder - Channel is closed, discarding remaining 48 byte(s) in buffer.
2015-06-22 17:53:23,460 [UserServer-1] ERROR o.a.d.exec.rpc.RpcExceptionHandler - Exception in RPC communication. Connection: /127.0.0.1:31010 <--> /127.0.0.1:55707 (user client). Closing connection.
io.netty.handler.codec.CorruptedFrameException: Received a message of length 0.
Any suggestion why this can happen? May be I need some extra setup of local drill?
You've used zk= in your JDBC URL, but the right hand side of that portion of the URL is pointing to 31010, which is the Drillbit's "user" port, per the docs:
http://drill.apache.org/docs/ports-used-by-drill/
For embedded mode you can try either:
jdbc:drill:zk=local
or
jdbc:drill:drillbit=localhost:31010
Hope that helps.
Other way to execute query by Calling Apache Drill REST API through code
Prerequisite:
1.Start Apache Drill
2.Add/enable Storage Plugin in http://localhost:8047/storage
3.Execute below code
public class RestAPI {
private static Log logger = LogFactory.getLog(RestAPI.class);
public static void main(String[] args) {
getQueryResponce();
}
private static void getQueryResponce(){
Client client = null;
WebTarget target = null;
try {
logger.info("---------Started execution-----------");
RequestQuery query = new RequestQuery();
query.setQueryType("SQL");
//MySQL
//query.setQuery("SELECT * FROM MYSQL.foodmart.collections");
//query.setQuery("SELECT * FROM MYSQL.foodmart.collections limit 100");
//query.setQuery("SELECT payment_due_from,NumItems FROM MYSQL.foodmart.collections limit 10");
//query.setQuery("SELECT count(SPORTS_PREFERENCE) FROM MYSQL.foodmart.collections group by SPORTS_PREFERENCE");
//query.setQuery("SELECT DISTINCT payment_due_from FROM MYSQL.foodmart.collections ");
//Mongo DB
//query.setQuery("select * from mongo.apache_drill.pt_BMS_preferences_data where SPORTS_PREFERENCE = 'Cricket' limit 10");
//query.setQuery("SELECT COUNT(SPORTS_PREFERENCE) FROM mongo.apache_drill.pt_BMS_preferences_data GROUP BY SPORTS_PREFERENCE");
query.setQuery("SELECT DISTINCT(SPORTS_PREFERENCE) FROM mongo.apache_drill.pt_BMS_preferences_data ");
client = ClientBuilder.newClient();
target = client.target("http://localhost:8047/query.json");
//target = target.path(path);
Response response = target.request().accept(MediaType.APPLICATION_JSON)
.post(Entity.json(query), Response.class);
if (response.getStatus() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
}
String string = response.readEntity(String.class);
logger.info(query.getQueryType()+"->"+query.getQuery());
logger.info("Responce:\n"+string);
logger.info("---------End execution-----------");
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(),e);
}
}
Hope this help...
Related
I installed MySQL Community 8.0.20 on my macOS Catalina. I'm pretty sure to have installed it correctly, since I could execute some CRUD instructions via Workbench application.
Then, I decided to write a simple Java application to access DB using JDBC. I prepared a Singleton class to get connection:
package connection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionHandler
{
private static ConnectionHandler handler = null;
private static final String JDBC_URL = "jdbc:mysql://localhost:3306/";
private static final String DATABASE = "javaTest";
private static final String DATABASE_ID = "root";
private static final String DATABASE_PW = "root_password";
private ConnectionHandler() {}
public synchronized static ConnectionHandler getInstance()
{
if(handler == null)
handler = new ConnectionHandler();
return handler;
}
public Connection getConnection() throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException
{
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
// Connection conn = DriverManager.getConnection(JDBC_URL + DATABASE, DATABASE_ID, DATABASE_PW);
Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/javaTest", "root", "root_password");
return conn;
}
}
If I execute application in debug mode, I can verify that it gets to penultimate instruction in method getConnection(), then after about 15 seconds the following exception is returned:
Exception in thread "main" com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at connection.ConnectionHandler.getConnection(ConnectionHandler.java:30)
at dao.JDBCExampleDAOImpl.findCustomerById(JDBCExampleDAOImpl.java:16)
at test.JDBCExampleTest.main(JDBCExampleTest.java:13)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:338)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:777)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:486)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:202)
at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1340)
at com.mysql.cj.NativeSession.connect(NativeSession.java:157)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826)
... 8 more
Caused by: javax.net.ssl.SSLException: Unsupported record version Unknown-0.0
at sun.security.ssl.InputRecord.checkRecordVersion(InputRecord.java:552)
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:565)
at sun.security.ssl.InputRecord.read(InputRecord.java:529)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:336)
at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188)
at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:329)
... 15 more
On the other hand, executing without debug I get the following:
Exception in thread "main" java.sql.SQLException: The server time zone value 'CEST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at connection.ConnectionHandler.getConnection(ConnectionHandler.java:30)
at dao.JDBCExampleDAOImpl.findCustomerById(JDBCExampleDAOImpl.java:16)
at test.JDBCExampleTest.main(JDBCExampleTest.java:13)
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'CEST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2118)
at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2142)
at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1310)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:967)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826)
... 8 more
MySQL is on and I closed Workbench, in case it could create conflicts.
Can you spot the problem?
Thanks for support.
I have a Java app (running Java 11) using HikariCP v3.3.1, with MySQL Connector/J version 8.0.17. I have specified username = 'foo' and password = 'password' and Hikari opens up a connection to the DB with these credentials. This all works.
There is a problem that I see in my logs, however. I have debugging enabled for Hikari and I see stack traces like so:
2019-09-10 01:35:13.452 DEBUG 4941 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Cannot acquire connection from data source
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 10 times. Giving up.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:897) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:822) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.3.1.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353) ~[HikariCP-3.3.1.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[HikariCP-3.3.1.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473) ~[HikariCP-3.3.1.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.access$100(HikariPool.java:71) ~[HikariCP-3.3.1.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:727) ~[HikariCP-3.3.1.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:713) ~[HikariCP-3.3.1.jar!/:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: com.mysql.cj.exceptions.CJException: Access denied for user 'administrator'#'localhost' (using password: YES)
It looks like it is trying to open a connection in the pool with user = 'administrator'. This naturally fails - because there is no such user in the database.
My question is this: why did Hikari open up one connection successfully to the db with user = 'foo' and password = 'password' but then try to open another connection with a different user = 'administrator'? 'administrator' by the way is the name of user that is running the Java process.
Here is the datasource bean. No other data source bean defined, I think.
#Bean
#ConfigurationProperties
public DataSource myDataSource() {
HikariConfig config = new HikariConfig();
config.setJdbcUrl(dburl);
config.setUsername(dbuser);
config.setPassword(password);
return new HikariDataSource(config);
}
The datasource - as I mentioned does get created with the correct username and password.
We get the values of the various attributes dburl and dbuser from #Value declarations that pull values from the properties files as follows:
#Value("${myorg.dburl}"
String dburl;
#Value("${myorg.dbusername"}"
String dbuser;
String password; //this comes from cloud secret store per org policy
The application properties has the following relevant lines
myorg.dbhost=localhost
myorg.dburl=jdbc:mysql://${myorg.dbhost}:3306/jobs?useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&useServerPrepStmts=false&rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8
myorg.dbusername=axcode
Thanks in advance!
Updated with new user experiment. So it gets even more curious. I created a new user on my Linux server 'foouser' - and ran the identical spring boot fat jar app. And, it works correctly with no exceptions thrown. Here is what I see from the periodic Hikari logs:
2019-09-12 12:30:46.685 DEBUG 3280 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
2019-09-12 12:31:16.685 DEBUG 3280 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
But when I run same app as 'administrator', then I see only 1 connection made to the db and an exception thrown when Hikari tries to open a second connection this time as user 'administrator'
2019-09-12 12:37:31.195 DEBUG 3514 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=1, active=0, idle=1, waiting=0)
2019-09-12 12:37:46.091 DEBUG 3514 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Cannot acquire connection from data source
I have connection testing enabled in my hibernate c3p0 properties but even after that i am facing connection issue.
Here is my connection configuration:
hibernate.connection.url = "jdbc:mysql://abc.eu-west-1.rds.amazonaws.com:3306/abc";
hibernate.dialect = "org.hibernate.dialect.MySQLDialect";
hibernate.cache.provider_class = "org.hibernate.cache.NoCacheProvider";
hibernate.hbm2ddl.auto = "update";
hibernate.show_sql = "false";
hibernate.connection.provider_class = "org.hibernate.c3p0.internal.C3P0ConnectionProvider";
hibernate.c3p0.min_size = "50";
hibernate.c3p0.max_size = "50";
hibernate.c3p0.idle_test_period = "100";
hibernate.c3p0.max_statements = "0";
hibernate.c3p0.timeout = "43200";
hibernate.c3p0.preferredTestQuery = "select 1";
hibernate.c3p0.testConnectionOnCheckout = "true";
Despite having enabled hibernate.c3p0.testConnectionOnCheckout i am getting the error:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 48,002,613 milliseconds ago. The last packet sent successfully to the server was 48,002,615 milliseconds ago. is longer than the server con
figured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnec
t=true' to avoid this problem.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_192]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_192]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_192]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_192]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) ~[mysql-connector-java-bin.jar:5.1.33]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1036) ~[mysql-connector-java-bin.jar:5.1.33]
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3661) ~[mysql-connector-java-bin.jar:5.1.33]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2417) ~[mysql-connector-java-bin.jar:5.1.33]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582) ~[mysql-connector-java-bin.jar:5.1.33]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526) ~[mysql-connector-java-bin.jar:5.1.33]
at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4842) ~[mysql-connector-java-bin.jar:5.1.33]
at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:1059) ~[c3p0-0.9.5.1.jar:0.9.5.1]
at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.begin(AbstractLogicalConnectionImplementor.java:67) ~[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.begin(LogicalConnectionManagedImpl.java:235) ~[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.begin(JdbcResourceLocalTransactionCoordinatorImpl.java:214) ~[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.engine.transaction.internal.TransactionImpl.begin(TransactionImpl.java:52) ~[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1525) ~[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
at org.hibernate.jpa.internal.TransactionImpl.begin(TransactionImpl.java:45) ~[hibernate-entitymanager-5.1.0.Final.jar:5.1.0.Final]
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66) ~[guice-persist-4.0.jar:?]
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:77) ~[guice-4.0.jar:?]
...
Shouldn't testConnectionOnCheckout test the connection before performing any query and prevent this kind of error?
If not what should i do to correct this error?
package com.soul.db;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
import java.sql.Connection;
public class JdbcSSHConnection {
/**
* Java Program to connect to remote database through SSH using port forwarding
* #throws SQLException
*/
public static void main(String[] args) throws SQLException {
int lport=443;
String rhost="10.99.69.10";
String host="10.105.27.201";
int rport=3306;
String user="root";
String password="SysPassword1";
String dbuserName = "root";
String dbpassword = "DBPassword1";
String url = "jdbc:mysql://localhost:"+lport+"/proj_db";//"jdbc:mysql://localhost:3306", "root", "mysql"
String driverName="com.mysql.jdbc.Driver";
Connection conn = null;
Session session= null;
try{
//Set StrictHostKeyChecking property to no to avoid UnknownHostKey issue
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
JSch jsch = new JSch();
session=jsch.getSession(user, host, 22);
session.setPassword(password);
session.setConfig(config);
session.connect();
System.out.println("Connected");
int assinged_port=session.setPortForwardingL(lport,rhost, rport);
System.out.println("localhost:"+assinged_port+" -> "+rhost+":"+rport);
System.out.println("Port Forwarded");
//mysql database connectivity
Class.forName(driverName).newInstance();
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection (url, "root", "DBPassword1");
// step3 create the statement object
Statement stmt = conn.createStatement();
System.out.println ("Database connection established");
// step4 execute query
ResultSet rs = stmt.executeQuery("select DISTINCT STUD_NAME from STUD_DETAILS;");
while (rs.next())
System.out.println(rs.getString(1));
// step5 close the connection object
conn.close();
//System.out.println ("Database connection established");
// System.out.println("DONE");
}catch(Exception e){
e.printStackTrace();
}finally{
if(conn != null && !conn.isClosed()){
System.out.println("Closing Database Connection");
conn.close();
}
if(session !=null && session.isConnected()){
System.out.println("Closing SSH Connection");
session.disconnect();
}
}
}
}
I installed SSH secure shell client on my windows machine.I am trying to connect mysql server installed in linux machine.
Now i am getting below Error:
Connected
localhost:443 -> 10.99.69.10:3306
Port Forwarded
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
com.mysql.jdbc.CommunicationsException
MESSAGE: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.io.EOFException
MESSAGE: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
STACKTRACE:
java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1997)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:573)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1044)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775)
at com.mysql.jdbc.Connection.(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.soul.db.JdbcSSHConnection.main(JdbcSSHConnection.java:54)
** END NESTED EXCEPTION **
Last packet sent to the server was 0 ms ago.
STACKTRACE:
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.io.EOFException
MESSAGE: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
STACKTRACE:
java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1997)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:573)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1044)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775)
at com.mysql.jdbc.Connection.(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.soul.db.JdbcSSHConnection.main(JdbcSSHConnection.java:54)
** END NESTED EXCEPTION **
Last packet sent to the server was 0 ms ago.
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:641)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1044)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775)
at com.mysql.jdbc.Connection.(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.soul.db.JdbcSSHConnection.main(JdbcSSHConnection.java:54)
** END NESTED EXCEPTION **
Last packet sent to the server was 0 ms ago.
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2847)
Closing SSH Connection
at com.mysql.jdbc.Connection.(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.soul.db.JdbcSSHConnection.main(JdbcSSHConnection.java:54)
These errors were resolved for me once I started using the hostname instead of the IP address for the SSH tunnel. I am also connecting to MySQL on Linux via SSH tunnel (with DataGrip IDE).
I installed Tomcat 7 and MySQL database on Linux Mandriva, but the application is deployed in the container can not get a connection.
I wrote two simple tests, and when to run them from the client, I get the connection -
public class TestHibernate {
/**
* #param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
User user = new User();
user.setName("userName");
user.setPassword("userPassword");
Session session = HibernateUtil.
getSessionFactory().openSession();
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
session.close();
}
}
Part of HibernateUtil -
...
cnf.setProperty("hibernate.connection.url", "jdbc:mysql://ip:3306/gibrid");
cnf.setProperty("hibernate.connection.username", "java");
cnf.setProperty("hibernate.connection.password", "java");
...
Jdbc test -
public class TestJdbc {
public static void main(String[] args) {
Connection conn = null;
String url = "jdbc:mysql://ip:3306/";
String dbName = "gibrid";
String driver = "com.mysql.jdbc.Driver";
String userName = "java";
String password = "java";
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
}
}
In these cases, I get a connection and can work with the database. But when I request from the client browser, I get a timeout. Why is that?
I would be very grateful for the information.
Here is the catalina.out -
...
INFO: Server startup in 5315 ms
17.10.2012 15:36:52 com.vaadin.terminal.gwt.server.AbstractApplicationServlet serveStaticResourcesInVAADIN
INFO: Requested resource [VAADIN/themes/web13theme/favicon.ico] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
17.10.2012 15:36:58 com.vaadin.terminal.gwt.server.AbstractApplicationServlet serveStaticResourcesInVAADIN
INFO: Requested resource [VAADIN/themes/projtheme/img/cancel.png] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
3 [http-bio-8081-exec-7] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA
25 [http-bio-8081-exec-7] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0.SP1
39 [http-bio-8081-exec-7] INFO org.hibernate.cfg.Environment - hibernate.properties not found
44 [http-bio-8081-exec-7] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
50 [http-bio-8081-exec-7] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
148 [http-bio-8081-exec-7] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA
176 [http-bio-8081-exec-7] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
247 [http-bio-8081-exec-7] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.ssi.domen.Incoming
313 [http-bio-8081-exec-7] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.ssi.domen.Incoming on table INCOMING
397 [http-bio-8081-exec-7] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.ssi.domen.Outcoming
397 [http-bio-8081-exec-7] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.ssi.domen.Outcoming on table OUTCOMING
400 [http-bio-8081-exec-7] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.ssi.domen.User
400 [http-bio-8081-exec-7] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.ssi.domen.User on table USER
402 [http-bio-8081-exec-7] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.ssi.domen.Cable
402 [http-bio-8081-exec-7] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.ssi.domen.Cable on table CABLE
497 [http-bio-8081-exec-7] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring
509 [http-bio-8081-exec-7] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
510 [http-bio-8081-exec-7] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
510 [http-bio-8081-exec-7] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
514 [http-bio-8081-exec-7] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://---ip here----/gibrid
514 [http-bio-8081-exec-7] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=java, password=****}
189691 [http-bio-8081-exec-7] WARN org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.ConnectException
MESSAGE: Connection timed out
STACKTRACE:
java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:218)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at com.ssi.hbnutils.HibernateUtil.<clinit>(HibernateUtil.java:34)
at com.ssi.windows.RegWindow.check(RegWindow.java:167)
at com.ssi.windows.RegWindow.insert(RegWindow.java:140)
at com.ssi.windows.RegWindow.access$0(RegWindow.java:139)
at com.ssi.windows.RegWindow$1.buttonClick(RegWindow.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
at com.vaadin.ui.Button.fireClick(Button.java:567)
at com.vaadin.ui.Button.changeVariables(Button.java:223)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1460)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1404)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1329)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:761)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:323)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
** END NESTED EXCEPTION **
Last packet sent to the server was 6 ms ago.
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2847)
at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at com.ssi.hbnutils.HibernateUtil.<clinit>(HibernateUtil.java:34)
at com.ssi.windows.RegWindow.check(RegWindow.java:167)
at com.ssi.windows.RegWindow.insert(RegWindow.java:140)
at com.ssi.windows.RegWindow.access$0(RegWindow.java:139)
at com.ssi.windows.RegWindow$1.buttonClick(RegWindow.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
at com.vaadin.ui.Button.fireClick(Button.java:567)
at com.vaadin.ui.Button.changeVariables(Button.java:223)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1460)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1404)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1329)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:761)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:323)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
190005 [http-bio-8081-exec-7] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect
190066 [http-bio-8081-exec-7] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
190090 [http-bio-8081-exec-7] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
190092 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
190092 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
190114 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: disabled
190115 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
190116 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
190125 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
190127 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
190127 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
190128 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
190128 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
190129 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
190167 [http-bio-8081-exec-7] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
190169 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
190169 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
190170 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
190171 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
190171 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
190173 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
190174 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
190239 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
190250 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
190250 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
190260 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
190260 [http-bio-8081-exec-7] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
190761 [http-bio-8081-exec-7] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
191112 [http-bio-8081-exec-7] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
380252 [http-bio-8081-exec-7] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 08S01
380252 [http-bio-8081-exec-7] ERROR org.hibernate.util.JDBCExceptionReporter - Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.ConnectException
MESSAGE: Connection timed out
STACKTRACE:
java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:218)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)
at com.ssi.windows.RegWindow.check(RegWindow.java:168)
at com.ssi.windows.RegWindow.insert(RegWindow.java:140)
at com.ssi.windows.RegWindow.access$0(RegWindow.java:139)
at com.ssi.windows.RegWindow$1.buttonClick(RegWindow.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
at com.vaadin.ui.Button.fireClick(Button.java:567)
at com.vaadin.ui.Button.changeVariables(Button.java:223)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1460)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1404)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1329)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:761)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:323)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
** END NESTED EXCEPTION **
Last packet sent to the server was 5 ms ago.
I'm not familiar with Hibernate, so I don't know if this is relevant:
"hibernate.properties not found"
"using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://---ip here----/gibrid"
Is the IP and port the same as in your test programs?
This blog hints at configuration problems with C3PO. One comment hints at different timeout settings between Mysql and C3PO. HTH
Editing your mysql configuration file to bind on 0.0.0.0 or your ip instead of 127.0.0.1 might work.