Score:0

Error java.sql.SQLNonTransientConnectionException between Glassfish 3 and MariaDB

ve flag

I have a java web application deployed in glassfish. This application interacts with Mariadb server. Suddenly, the app stops working. I'm checking the app.log and glassfish server log and I have the following results:

app.log

Could not open JDBC Connection for transaction; nested exception is java.sql.SQLNonTransientConnectionException: Could not send query: Last packet not finished

server.log

### The error may exist in file [/opt/glassfish3/glassfish/domains/domain1/applications/exampleApp/WEB-INF/class/model/xml/ParameterMapper.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT NOW();
### Cause: java.sql.SQLNonTransientConnectionException: Could not send query: Last packet not finished
; SQL []; Could not send query: Last packet not finished; nested exception is java.sql.SQLNonTransientConnectionException: Could not send query: Last packet not finished|#]

The application repeats same database operations every 5 minutes.

I tried to reload the application by glassfish but it didn't work. The only way is restarting the server and it works but not for long.

What is happening for this case? or What can I do?

Score:0
ve flag

I got the answer. What I did is changing wait_timeout parameter in server.cnf. The value was 30 and I changed to its default value 28800. It could be set lower than 28800 but that's another issue. What happened was the java app executed several insert operations every 5 minutes so the connection was closed by Mariadb server because of wait_timeout. I'm wondering the DB connection was singleton and the app was not validating if the connection was closed.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.