I am having the following exception in my Java server several times. Because of this my java server get stopped.
java.sql.SQLException: Server connection failure during transaction. Due to underlying exception: 'java.net.NoRouteToHostException: No route to host'.
** BEGIN NESTED EXCEPTION **
java.net.NoRouteToHostException
MESSAGE: No route to host
STACKTRACE:
java.net.NoRouteToHostException: No route to host
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress( Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(Stand ardSocketFactory.java:124)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:225)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1899)
at com.mysql.jdbc.Connection.<init>(Connection.java:4 50)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:411)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.apache.commons.dbcp.DriverManagerConnectionFac tory.createConnection(DriverManagerConnectionFacto ry.java:48)
at org.apache.commons.dbcp.PoolableConnectionFactory. makeObject(PoolableConnectionFactory.java:290)
at org.apache.commons.pool.impl.GenericObjectPool.bor rowObject(GenericObjectPool.java:771)
at org.apache.commons.dbcp.PoolingDriver.connect(Pool ingDriver.java:175)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.RJSoftwares.ServerSide.DBConnect.doLogOff(DBCo nnect.java:540)
at com.RJSoftwares.ServerSide.Server.doUserLogoff(Ser ver.java:1159)
at com.RJSoftwares.ServerSide.Server$logOff.run(Serve r.java:177)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
** END NESTED EXCEPTION **
Attempted reconnect 3 times. Giving up.
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1968)
at com.mysql.jdbc.Connection.<init>(Connection.java:4 50)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:411)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.apache.commons.dbcp.DriverManagerConnectionFac tory.createConnection(DriverManagerConnectionFacto ry.java:48)
at org.apache.commons.dbcp.PoolableConnectionFactory. makeObject(PoolableConnectionFactory.java:290)
at org.apache.commons.pool.impl.GenericObjectPool.bor rowObject(GenericObjectPool.java:771)
at org.apache.commons.dbcp.PoolingDriver.connect(Pool ingDriver.java:175)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.RJSoftwares.ServerSide.DBConnect.doLogOff(DBCo nnect.java:540)
at com.RJSoftwares.ServerSide.Server.doUserLogoff(Ser ver.java:1159)
at com.RJSoftwares.ServerSide.Server$logOff.run(Serve r.java:177)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
Could you tell me a solution to track it in my application and handle it in a way that my application does not get crashed.
Thanks