For one of our client, we are using DHIS2.21 with MySQL 5.6. Application server and database server are separate and can talk to each other.
Since last 3 weeks, they are facing issues and getting the below message instead of login screen.
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed
After refreshing the page twice or thrice login page gets loaded.
I tried to check the log file and found below errors
org.hibernate.TransactionException: JDBC begin transaction failed
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
java.net.SocketException: Connection reset
Has anyone had any idea about these and how these can be rectified? Any help is much appreciated.
This seems to be a known problem between mysql, java and c3p0 (the database connection pool). It seems that mysql resets connections which are not used for 8 hours (by default). For some reason these stale connections then get served up from the connection pool giving rise to this error.
You can kick the problem further down the tracks by increasing the timeout on the mysql side. check the documentation for the configuration option.
Or you can make c3p0 more robust, for example by checking connections on checkout (google ‘c3p0 mysql reset’ for lots of discussion, tips, advice etc). This involves tweaking hibernate settings, possibly inside the war file. I haven’t tested myself on mysql for a long time. I think HISP India folk probably have the best experience of supporting mysql on DHIS2 over the years.
For one of our client, we are using DHIS2.21 with MySQL 5.6. Application server and database server are separate and can talk to each other.
Since last 3 weeks, they are facing issues and getting the below message instead of login screen.
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed
After refreshing the page twice or thrice login page gets loaded.
I tried to check the log file and found below errors
org.hibernate.TransactionException: JDBC begin transaction failed
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
java.net.SocketException: Connection reset
Has anyone had any idea about these and how these can be rectified? Any help is much appreciated.
This seems to be a known problem between mysql, java and c3p0 (the database connection pool). It seems that mysql resets connections which are not used for 8 hours (by default). For some reason these stale connections then get served up from the connection pool giving rise to this error.
You can kick the problem further down the tracks by increasing the timeout on the mysql side. check the documentation for the configuration option.
Or you can make c3p0 more robust, for example by checking connections on checkout (google ‘c3p0 mysql reset’ for lots of discussion, tips, advice etc). This involves tweaking hibernate settings, possibly inside the war file. I haven’t tested myself on mysql for a long time. I think HISP India folk probably have the best experience of supporting mysql on DHIS2 over the years.
For one of our client, we are using DHIS2.21 with MySQL 5.6. Application server and database server are separate and can talk to each other.
Since last 3 weeks, they are facing issues and getting the below message instead of login screen.
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed
After refreshing the page twice or thrice login page gets loaded.
I tried to check the log file and found below errors
org.hibernate.TransactionException: JDBC begin transaction failed
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
java.net.SocketException: Connection reset
Has anyone had any idea about these and how these can be rectified? Any help is much appreciated.