繁体   English   中英

org.springframework.jdbc.CannotGetJdbcConnectionException

[英]org.springframework.jdbc.CannotGetJdbcConnectionException

我在 spring3 项目中工作。 当我运行我的代码时,有时我会得到这个 Jdbc 连接异常,用于某些特定功能,但其他功能工作得很好。 而且这个异常并没有重复发生,但有时,所以我不知道错误在哪里。 请帮助我摆脱这个问题。

<[weblogic.servlet.internal.WebAppServletContext@1b6e978 - appName:'_auto_generated_ear_',名称:'ae',上下文路径:'/ae'] ServletException 的根本原因。 org.springframework.jdbc.CannotGetJdbcConnectionException:无法获得 JDBC 连接; 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.在 oracle63A6 58CE6080CAA87C7Z.driver.T4CConnection.(T4CConnection.java:165) 被截断。 查看日志文件以获取完整的堆栈跟踪

这种症状有两个常见原因

  • 连接池已耗尽,打开的活动连接太多,下一个客户端无法获取它。 这可能是连接池泄漏
  • 连接池设置不会周期性地/借用时测试空闲连接,因此当OS连接截断TCP连接时(例如:因为操作系统认为它无效而无效),池仍然认为它是有效的

要解决此问题,只需重新启动您的 MySQL 服务

如何重启MySQL服务
在 Windows 上: https://www.mysqltutorial.org/mysql-adminsitration/restart-mysql
在 Linux 上: https://linuxhint.com/restart-mysql-in-ubuntu/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM