这是事务重复执行了???

努力加载中 2016-11-09 04:35:54
jpa+spring data+hibernate....功能上没问题 数据插入到数据库了,就是报这个错。。。

16:28:07.545 [http-bio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'spring' processing GET request for [/live-web/Test/testdb]
16:28:07.546 [http-bio-8080-exec-10] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /Test/testdb
16:28:07.546 [http-bio-8080-exec-10] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Returning handler method [public java.lang.String com.live.test.TestController.testdb(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)]
16:28:07.547 [http-bio-8080-exec-10] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'testController'
16:28:07.547 [http-bio-8080-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - Last-Modified value for [/live-web/Test/testdb] is: -1
16:28:07.547 [http-bio-8080-exec-10] DEBUG o.s.orm.jpa.JpaTransactionManager - Creating new transaction with name [com.live.service.impl.DBTestServiceImpl.Test]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
16:28:07.548 [http-bio-8080-exec-10] DEBUG o.s.orm.jpa.JpaTransactionManager - Opened new EntityManager [org.hibernate.ejb.EntityManagerImpl@2c3e4688] for JPA transaction
16:28:07.548 [http-bio-8080-exec-10] DEBUG o.h.e.t.spi.AbstractTransactionImpl - begin
16:28:07.548 [http-bio-8080-exec-10] DEBUG o.h.e.j.i.LogicalConnectionImpl - Obtaining JDBC connection
16:28:07.549 [http-bio-8080-exec-10] DEBUG o.h.e.j.i.LogicalConnectionImpl - Obtained JDBC connection
16:28:07.549 [http-bio-8080-exec-10] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
16:28:07.549 [http-bio-8080-exec-10] DEBUG o.h.e.t.i.jdbc.JdbcTransaction - initial autocommit status: true
16:28:07.549 [http-bio-8080-exec-10] DEBUG o.h.e.t.i.jdbc.JdbcTransaction - disabling autocommit
16:28:07.550 [http-bio-8080-exec-10] DEBUG o.s.orm.jpa.JpaTransactionManager - Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@2c88a169]
16:28:07.551 [http-bio-8080-exec-10] DEBUG o.s.orm.jpa.JpaTransactionManager - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@2c3e4688] for JPA transaction
16:28:07.552 [http-bio-8080-exec-10] DEBUG o.s.orm.jpa.JpaTransactionManager - Participating in existing transaction
16:28:07.553 [http-bio-8080-exec-10] DEBUG o.s.data.auditing.AuditingHandler - Touched BaseEntity [id=null, createBy=Live_Font_User, createDate=Wed Nov 09 16:28:07 CST 2016, updateBy=Live_Font_User, updateDate=Wed Nov 09 16:28:07 CST 2016, version=null, isDeleted=0] - Last modification at 2016-11-09T16:28:07.553+08:00 by Live_Font_User
16:28:07.554 [http-bio-8080-exec-10] DEBUG o.h.e.i.AbstractSaveEventListener - Generated identifier: 8a83bd6558482ca7015848338c020001, using strategy: org.hibernate.id.UUIDHexGenerator
16:28:07.555 [http-bio-8080-exec-10] DEBUG o.s.orm.jpa.JpaTransactionManager - Initiating transaction commit
16:28:07.555 [http-bio-8080-exec-10] DEBUG o.s.orm.jpa.JpaTransactionManager - Committing JPA transaction on EntityManager [org.hibernate.ejb.EntityManagerImpl@2c3e4688]
16:28:07.555 [http-bio-8080-exec-10] DEBUG o.h.e.t.spi.AbstractTransactionImpl - committing
16:28:07.555 [http-bio-8080-exec-10] DEBUG o.h.e.i.AbstractFlushingEventListener - Processing flush-time cascades
16:28:07.556 [http-bio-8080-exec-10] DEBUG o.h.e.i.AbstractFlushingEventListener - Dirty checking collections
16:28:07.556 [http-bio-8080-exec-10] DEBUG o.h.e.i.AbstractFlushingEventListener - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
16:28:07.557 [http-bio-8080-exec-10] DEBUG o.h.e.i.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
16:28:07.557 [http-bio-8080-exec-10] DEBUG o.h.internal.util.EntityPrinter - Listing entities:
16:28:07.557 [http-bio-8080-exec-10] DEBUG o.h.internal.util.EntityPrinter - com.live.entity.LiveList{updateBy=Live_Font_User, id=8a83bd6558482ca7015848338c020001, author=null, title=hehe, isDeleted=0, createDate=Wed Nov 09 16:28:07 CST 2016, channel=null, createBy=Live_Font_User, url=null, updateDate=Wed Nov 09 16:28:07 CST 2016, version=0}
16:28:07.557 [http-bio-8080-exec-10] DEBUG org.hibernate.SQL - insert into LiveList (createby, createdate, isdelete, updateby, updatedate, version, author, channel, title, url, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
16:28:07.580 [http-bio-8080-exec-10] DEBUG o.h.e.jdbc.spi.SqlExceptionHelper - could not log warnings
java.sql.SQLException: org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement with address: "com.mysql.jdbc.JDBC4PreparedStatement@64d35af5: EXCEPTION: java.sql.SQLException: No operations allowed after statement closed." is closed.

...全文
333 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
努力加载中 2017-01-19
  • 打赏
  • 举报
回复
引用 7 楼 bcsflilong 的回复:
[quote=引用 6 楼 io437 的回复:] [quote=引用 5 楼 bcsflilong 的回复:] [quote=引用 3 楼 io437 的回复:] [quote=引用 1 楼 bcsflilong 的回复:] 是不是事务关闭了 你有查询操作了
Debug 的时候发现cleanupTransactionInfo(txInfo); commitTransactionAfterReturning(txInfo); 这2个方法执行了3次。第二第三次 DelegatingPreparedStatement 这个statement 关闭了 所以报错,但是第二第三次的操作不是我写的。功能上才没问题,就是报这个错。 [/quote]别人写的 或者 是框架自己操作的? 如果是框架操作的 一定有什么地方可以配置[/quote] 别人写的就不会 因为是我自己开的项目玩的。 配置的话,我百度了好多方法都试过,主要是问题不清楚出在哪里。 百度有说bean重复实体化了,试过也不不行。 求大神解决,虽然不影响功能,但是就是抱着这么一串东西 看着不舒服。[/quote] bean 都配置成单例试试?[/quote] 谢谢你的帮助,已经都是单例的了。把log的等级提高了看不到那段信息,对应用也没有任何影响后来就没理了。还是谢谢你的帮助
bcsflilong 2016-11-10
  • 打赏
  • 举报
回复
引用 6 楼 io437 的回复:
[quote=引用 5 楼 bcsflilong 的回复:] [quote=引用 3 楼 io437 的回复:] [quote=引用 1 楼 bcsflilong 的回复:] 是不是事务关闭了 你有查询操作了
Debug 的时候发现cleanupTransactionInfo(txInfo); commitTransactionAfterReturning(txInfo); 这2个方法执行了3次。第二第三次 DelegatingPreparedStatement 这个statement 关闭了 所以报错,但是第二第三次的操作不是我写的。功能上才没问题,就是报这个错。 [/quote]别人写的 或者 是框架自己操作的? 如果是框架操作的 一定有什么地方可以配置[/quote] 别人写的就不会 因为是我自己开的项目玩的。 配置的话,我百度了好多方法都试过,主要是问题不清楚出在哪里。 百度有说bean重复实体化了,试过也不不行。 求大神解决,虽然不影响功能,但是就是抱着这么一串东西 看着不舒服。[/quote] bean 都配置成单例试试?
努力加载中 2016-11-10
  • 打赏
  • 举报
回复
引用 5 楼 bcsflilong 的回复:
[quote=引用 3 楼 io437 的回复:] [quote=引用 1 楼 bcsflilong 的回复:] 是不是事务关闭了 你有查询操作了
Debug 的时候发现cleanupTransactionInfo(txInfo); commitTransactionAfterReturning(txInfo); 这2个方法执行了3次。第二第三次 DelegatingPreparedStatement 这个statement 关闭了 所以报错,但是第二第三次的操作不是我写的。功能上才没问题,就是报这个错。 [/quote]别人写的 或者 是框架自己操作的? 如果是框架操作的 一定有什么地方可以配置[/quote] 别人写的就不会 因为是我自己开的项目玩的。 配置的话,我百度了好多方法都试过,主要是问题不清楚出在哪里。 百度有说bean重复实体化了,试过也不不行。 求大神解决,虽然不影响功能,但是就是抱着这么一串东西 看着不舒服。
bcsflilong 2016-11-10
  • 打赏
  • 举报
回复
引用 3 楼 io437 的回复:
[quote=引用 1 楼 bcsflilong 的回复:] 是不是事务关闭了 你有查询操作了
Debug 的时候发现cleanupTransactionInfo(txInfo); commitTransactionAfterReturning(txInfo); 这2个方法执行了3次。第二第三次 DelegatingPreparedStatement 这个statement 关闭了 所以报错,但是第二第三次的操作不是我写的。功能上才没问题,就是报这个错。 [/quote]别人写的 或者 是框架自己操作的? 如果是框架操作的 一定有什么地方可以配置
努力加载中 2016-11-10
  • 打赏
  • 举报
回复
引用 2 楼 qw0907 的回复:
如果确定代码没有问题的话, 看一下是不是 表 锁了, 最好debug一下,输出sql, 用输出的sql直接在 insert 一下。
11:15:05.105 [http-bio-8080-exec-2] DEBUG o.s.orm.jpa.JpaTransactionManager - Initiating transaction commit 11:15:05.105 [http-bio-8080-exec-2] DEBUG o.s.orm.jpa.JpaTransactionManager - Committing JPA transaction on EntityManager [org.hibernate.ejb.EntityManagerImpl@2f98819b] 11:15:05.105 [http-bio-8080-exec-2] DEBUG o.h.e.t.spi.AbstractTransactionImpl - committing 11:15:05.106 [http-bio-8080-exec-2] DEBUG o.h.e.i.AbstractFlushingEventListener - Processing flush-time cascades 11:15:05.109 [http-bio-8080-exec-2] DEBUG o.h.e.i.AbstractFlushingEventListener - Dirty checking collections 11:15:05.115 [http-bio-8080-exec-2] DEBUG o.h.e.i.AbstractFlushingEventListener - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects 11:15:05.115 [http-bio-8080-exec-2] DEBUG o.h.e.i.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections 11:15:05.118 [http-bio-8080-exec-2] DEBUG o.h.internal.util.EntityPrinter - Listing entities: 11:15:05.119 [http-bio-8080-exec-2] DEBUG o.h.internal.util.EntityPrinter - com.live.entity.LiveList{updateBy=Live_Font_User, id=8a83bd65584c3b3101584c3b4eca0000, author=null, title=hehe, isDeleted=0, createDate=Thu Nov 10 11:15:04 CST 2016, channel=null, createBy=Live_Font_User, url=null, updateDate=Thu Nov 10 11:15:04 CST 2016, version=0} 11:15:05.281 [http-bio-8080-exec-2] DEBUG org.hibernate.SQL - insert into LiveList (createby, createdate, isdelete, updateby, updatedate, version, author, channel, title, url, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) sql没错 提交事务好像提交了2次 看上去。求大神解救 看红字,
努力加载中 2016-11-10
  • 打赏
  • 举报
回复
引用 1 楼 bcsflilong 的回复:
是不是事务关闭了 你有查询操作了
Debug 的时候发现cleanupTransactionInfo(txInfo); commitTransactionAfterReturning(txInfo); 这2个方法执行了3次。第二第三次 DelegatingPreparedStatement 这个statement 关闭了 所以报错,但是第二第三次的操作不是我写的。功能上才没问题,就是报这个错。
快跑蜗牛哥 2016-11-10
  • 打赏
  • 举报
回复
如果确定代码没有问题的话, 看一下是不是 表 锁了, 最好debug一下,输出sql, 用输出的sql直接在 insert 一下。
bcsflilong 2016-11-09
  • 打赏
  • 举报
回复
是不是事务关闭了 你有查询操作了

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧