Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;

解决报错

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Jan 07 21:06:43 CST 2020
There was an unexpected error (type=Internal Server Error, status=500).
nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. ### The error may exist in com/imooc/mapper/StuMapper.java (best guess) ### The error may involve com.imooc.mapper.StuMapper.selectByPrimaryKey ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

检查数据库名 密码 端口无误后

修改包的版本

   <version>5.1.41</version>

  改为

   <version>5.1.47</version>

重新运行项目 报错解决 可以调接口

{"id":1001,"name":"test","age":20}

原文地址:https://www.cnblogs.com/guangzhou11/p/12163768.html

时间: 2024-11-06 07:12:55

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;的相关文章

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection

问题:维护团队原有java项目,spring + mybatis.所在机器重启后,重启项目,tomcat已启动,报以下错 解决: 根据错误信息推测与数据库有关,在Linux上执行mysql,报错 which mysql sh xx/bin/mysqld_safe # xx为安装地址 执行mysql无问题,项目仍报错.mysql语句链接项目使用数据库,报错:链接另一个一直数据库,可链接 进入项目所在目录下使用的mysql文件夹,执行sh xx/bin/mysqld_safe 梳理: mysql作为

springMVC中出现Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:怎么办

出现这个是因为你的数据库没有连接上导致的 检查以下几个地方 1.你的db.properties文件是否配置正确    useUnicode=true&&characterEncoding=UTF-8表示你设置的编码为utf-8保证与数据库的一致   防止乱码 2.检查你的spring/applicationContext-dao.xml是否配置了数据源   而且是否配置正确 3.你的连接名是否是正确的和你在db.properties中配置的是否一样 . 4.你电脑中的服务是否打开 5.检查

org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection

org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot cr

Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for &hellip;

编译通过并且运行web成功后,访问的页面不需要连接数据库,不牵扯到反射调用实体类就不会报错, 报错内容如下: [WARNING] org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exce

jdbc连接oracle时报错 Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableC

错误: Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure Last packet sent

mybatis查询异常-Error querying database. Cause: java.lang.ClassCastException: org.apache.ibatis.executor.ExecutionPlaceholder cannot be cast to java.util.List

背景,mybatis查询的时候直接取的sqlsession,没有包装成SqlSessionTemplate,没有走spring提供的代理. 然后我写的获取sqlsession的代码没有考虑到并发的情况,导致sqlsession建的太多 并发大了之后,查询报错 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.ClassCastException: org

搭建Mybatis 出现 Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for mapper.BatchCustomer.findBatchCustomerOneToOne

Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for mapper.BatchCustomer.findBatchCustomerOneToOne### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does

Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named &#39;ItemsCustom&#39; in &#39;class com.pojo.OrderDetailCustom

再用 junit 测试MyBatis时发现的错误: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'ItemsCustom' in 'class com.pojo.OrderDetailCust

Mybatis报错 Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class com.me.mybatis.pojo.Orders with invalid types () or values ().

在学mybaits的时候遇到了这个错误,而且卡住了我三个小时也找不到,最后分析出来不能初始化类,然后就结合着之前自己以前的一点经验发现只有有参构造没有无参构造,因此只需要添加上无参构造就可以了. 错误源码 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: Error ins