Skip to main content

GlassFish 3.1 - Connection could not be allocated because: Communications link failure The last packet sent successfully

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
MoOoG
Offline
Joined: 2013-08-28
Points: 0

Here is the full error:

Ping Connection Pool for test is Failed. Ping failed Exception - Connection could not be allocated because: 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. Please check the server.log for more details.

So, I'm using GlassFish 3.1 and I'm trying to connect from my computer at home to mysql database which is at my college. I set these setting at the admin panel:
Resource type: Javax.sql.DataSource
Datasource Classname: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
...And other data like password, username, port etc., which i tried before in MySql Workbench, so I'm sure they work fine.

When I ping, I get the error above. I tried to turn off the firewall and it's not fixing the problem.. If you need any more specific information I will post one, I can also post screenshots if you need.
What could go wrong actually?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Yser
Offline
Joined: 2013-09-09
Points: 0

Hey,

the problem could be with wait_times.

mysql is closing idle connections without any information for any clients.
so you have to set the idle timeout time in glassfish jdbc pool to a lower value than the value in my.cnf -> wait_time for mysql. thus glassfish can properly shut down the connections before mysql is killing them ;)