java org.springframework.jdbc.CannotGetJdbcConnectionException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17720902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
org.springframework.jdbc.CannotGetJdbcConnectionException
提问by kavi
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.
我在 spring3 项目中工作。当我运行我的代码时,有时我会收到一些特定功能的 Jdbc 连接异常,但其他功能工作得很好。而且这个异常不会重复发生,但有时,所以我不知道错误在哪里。请帮我解决这个问题。
<[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
<[weblogic.servlet.internal.WebAppServletContext@1b6e978 - appName: '_auto_generated_ear_', name: 'ae', context-path: '/ae'] ServletException 的根本原因。org.springframework.jdbc.CannotGetJdbcConnectionException: 无法获得 JDBC 连接;嵌套异常是 java.sql.SQLException:侦听器拒绝连接并出现以下错误:ORA-12519,TNS:未找到合适的服务处理程序 客户端使用的连接描述符是:org.springframework.jdbc 上的 localhost:1521:XE。 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)在 org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666) 在 org。springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674) 被截断。请参阅日志文件以获取完整的堆栈跟踪 java.sql.SQLException:侦听器拒绝连接并出现以下错误:ORA-12519,TNS:未找到合适的服务处理程序客户端使用的连接描述符为: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) 被截断。查看日志文件以获取完整的堆栈跟踪 请参阅日志文件以获取完整的堆栈跟踪 java.sql.SQLException:侦听器拒绝连接并出现以下错误:ORA-12519,TNS:未找到合适的服务处理程序客户端使用的连接描述符为: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) 被截断。查看日志文件以获取完整的堆栈跟踪 请参阅日志文件以获取完整的堆栈跟踪 java.sql.SQLException:侦听器拒绝连接并出现以下错误:ORA-12519,TNS:未找到合适的服务处理程序客户端使用的连接描述符为: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) 被截断。查看日志文件以获取完整的堆栈跟踪 没有找到合适的服务处理程序客户端使用的连接描述符是: 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) 被截断了。查看日志文件以获取完整的堆栈跟踪 没有找到合适的服务处理程序客户端使用的连接描述符是: 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) 被截断了。查看日志文件以获取完整的堆栈跟踪 387) 在 oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:420) 在 oracle.jdbc.driver.T4CConnection.(T4CConnection.java:165) 被截断。查看日志文件以获取完整的堆栈跟踪 387) 在 oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:420) 在 oracle.jdbc.driver.T4CConnection.(T4CConnection.java:165) 被截断。查看日志文件以获取完整的堆栈跟踪
回答by gerrytan
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
- 连接池耗尽,打开的活动连接太多,下一个客户端无法获取。这可能是连接池泄漏
- 连接池设置不会定期/借用时测试空闲连接,因此当 TCP 连接被操作系统截断时(例如:因为操作系统认为它空闲什么都不做),连接池仍然认为它是有效的