kavi
kavi

Reputation: 373

org.springframework.jdbc.CannotGetJdbcConnectionException

I am working in spring3 project. When I run my code sometimes i am getting this Jdbc Connection Exception for some particular functionality but other functionalities working very fine. And also this Exception is not occurring repetitively but sometimes, So I can't get where the mistake will be. Please help me to come out of this problem.

<[weblogic.servlet.internal.WebAppServletContext@1b6e978 - appName: '_auto_generated_ear_', name: 'ae', context-path: '/ae'] Root cause of ServletException. org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Listener refused the connection with the following error: ORA-12519, TNS:no appropriate service handler found The Connection descriptor used by the client was: localhost:1521:XE at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674) Truncated. see log file for complete stacktrace java.sql.SQLException: Listener refused the connection with the following error: ORA-12519, TNS:no appropriate service handler found The Connection descriptor used by the client was: localhost:1521:XE at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387) at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:420) at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:165) Truncated. see log file for complete stacktrace

Upvotes: 4

Views: 27451

Answers (2)

Venkata Siva Krishna
Venkata Siva Krishna

Reputation: 19

To resolve this issue, just Restart your MySQL service

How to restart the MySQL service
On Windows: https://www.mysqltutorial.org/mysql-adminsitration/restart-mysql
On Linux:    https://linuxhint.com/restart-mysql-in-ubuntu/

Upvotes: 0

gerrytan
gerrytan

Reputation: 41123

There are 2 common reason for that symptoms

  • The connection pool is exhausted, too many active connections open and the next client cannot get it. This might be a connection pool leak
  • The connection pool setting doesn't test idle connection periodically / on borrow, hence when TCP connection truncated by OS (eg: because the OS thinks it's idle doing nothing), the pool still thinks it's a valid

Upvotes: 9

Related Questions