当前位置: 代码迷 >> Java相关 >> com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException
  详细解决方案

com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException

热度:7415   发布时间:2013-02-25 21:50:44.0
java 的报错信息是否精确
下面的java错误提示有Deadlock,
这里质疑 java 的报错信息是否精确。
另外Deadlock好像是针对2个以上的表, 不是针对一个表吧? 急切询问。
(java是否会很为平常的lock等待也为 deadlock)?


PersisterDAO: stange error:com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction 
com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction 
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
  at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) 
  at com.mysql.jdbc.Util.getInstance(Util.java:381) 
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1046) 
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957) 
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376) 
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308) 
  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837) 
  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961) 
  at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543) 
  at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737) 
  at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:998) 
  at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169) 
  at com.oddsmatrix.website.oddshistory.db.rsisterDAO.saveRecordsPS(terDAO.java:640) 
  at com.oddsmatrix.website.oddshistory.db.terDAO.saveRecords(OersisterDAO.java:296) 
  at com.oddsmatrix.website.oddshistory.db.toryPersisterDAO.saveRecords(istoryPersisterDAO.java:250) 
  at com.oddsmatrix.website.oddshistory.db.dao.OddsHistoryUpdatedOddsModelObjectsPersister.saveUpdates(HistoryUpdatedOddsModelObjectsPersister.java:76) 
  at com.oddsmatrix.website.persister.mediator.MediatorConnector.applyUpdates(MorConnector.java:235) 
  at com.oddsmatrix.website.persister.mediator.MediatorConnector.receiveUpdates(MtorConnector.java:192) 
  at com.oddsmatrix.website.persister.OddsPersisterApp.run(OddsPersisterApp.java:71) 
  at java.lang.Thread.run(Thread.java:

------解决方案--------------------------------------------------------
java是根据数据库的错误返回码判断异常,不会有问题
------解决方案--------------------------------------------------------
探讨
下面的java错误提示有Deadlock,
这里质疑  java 的报错信息是否精确。
另外Deadlock好像是针对2个以上的表,  不是针对一个表吧?  急切询问。
(java是否会很为平常的lock等待也为 deadlock)?


PersisterDAO:  stange  error:com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException:  Deadlock  found  when  trying  to  get  lock;  try  restarting  transaction
com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException:  Deadlock  found  when  trying  to  get  lock;  try  restarting  transaction
        at  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native  Method)
  相关解决方案