baidu_29075865
baidu_29075865
2015-06-16 06:22
采纳率: 0%
浏览 4.1k

java 启动jdbc 事务报错 嵌套异常

图片说明图片说明org.mybatis.spring.MyBatisSystemException: nested exception is 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 load JDBC driver class '2678A9D8A4F5FA0707A5F652001ACABE816EE484B994AE39ED963C5A4B2DA3A22B8ABA272F176A7C2C239A79A6364D41'

The error may exist in cn/drzk/wanda/cinema/dao/form/dao/TicketsFromDao.java (best guess)

The error may involve cn.drzk.wanda.cinema.dao.form.dao.TicketsFromDao.count

The error occurred while executing a query

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '2678A9D8A4F5FA0707A5F652001ACABE816EE484B994AE39ED963C5A4B2DA3A22B8ABA272F176A7C2C239A79A6364D41'

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • francislpx
    SimbaLi123 2015-06-16 06:27

    Cannot load JDBC driver

    点赞 评论
  • qq_16168871
    我是主厨 2015-06-16 06:36

    看看你的驱动,看看连接字符串对不。看看驱动包对不。

    点赞 评论
  • beacon_2011
    beaconD 2015-06-16 06:39

    按照mybatis手册中所说的,association有两种实现方式,嵌套查询和嵌套结果映射。如手册中所述,select方式会带来N+1次查询的问题,考虑到效率问题的话建议使用嵌套结果映射。但是在结合使用rowbounds进行分页的时候嵌套结果映射会报Mapped Statements with nested result mapping cannot be safely constrained by rowbounds异常。解决方案:新建一个RowBoundCapsule类,将原来的查询参数和limit、offset封装到一起,并采用如下的方式改写map select t.tid as tid, t.uid as tuid, t.content as content, t.commentcount as commentcount, t.pptime as pptime, u.uid as uid, u.email as email, u.nickname as nickname, u.login as login, u.pass as pass, u.pic as pic from topic as t LEFT JOIN user as u on t.uid = u.uid where t.uid = #{o} #{o}代表原来的参数。这样就可以把分页的任务交给数据库来完成了。limit #{offset},#{limit}

    点赞 评论

相关推荐