gpt4 book ai didi

java - org.hibernate.exception.JDBCConnectionException : could not insert, 如何在生产环境中查找问题

转载 作者:行者123 更新时间:2023-11-30 23:35:58 26 4
gpt4 key购买 nike

当你遇到这些问题时,你从哪里开始?我在开发环境中重现这些错误时遇到问题。

我们在树脂服务器上运行这段代码。我们有在事务中的线程中运行的插件。

我们有一些代码可以刷新 session ,有些则不能。是否有一些日志记录提供比这更有用的信息。

06:44:48 [ERROR]: AbstractHibernateFactory.java:127 - Cought this saving a sherlock.common.dao.BatchLogorg.hibernate.exception.JDBCConnectionException: could not insert: [sherlock.common.dao.BatchLog]    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99)    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)    at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2329)    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2836)    at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)    at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)    at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)    at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)    at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:677)    at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:669)    at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:665)    at framework.hibernate.service.AbstractHibernateFactory.saveOrUpdate(AbstractHibernateFactory.java:124)    at sherlock.common.service.BatchServiceImpl.log(BatchServiceImpl.java:148)    at sherlock.common.service.BatchServiceImpl.log(BatchServiceImpl.java:128)    at sherlock.plugin.imports.CompanyImportPlugin.executePlugin(CompanyImportPlugin.java:184)    at sherlock.backend.job.AbstractHibernatePlugin.execute(AbstractHibernatePlugin.java:70)    at sherlock.backend.job.AbstractPluginJobTask.run(AbstractPluginJobTask.java:180)    at framework.util.task.TaskEngine$TaskEngineWorker.run(TaskEngine.java:174)Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed.    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:409)    at com.mysql.jdbc.Util.getInstance(Util.java:384)    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)    at com.mysql.jdbc.StatementImpl.checkClosed(StatementImpl.java:404)    at com.mysql.jdbc.PreparedStatement.clearParameters(PreparedStatement.java:1140)    at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.clearParameters(PreparedStatementWrapper.java:805)    at com.caucho.sql.UserPreparedStatement.clearParameters(UserPreparedStatement.java:158)    at com.caucho.sql.UserPreparedStatement.close(UserPreparedStatement.java:724)    at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:563)    at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:291)    at org.hibernate.id.insert.AbstractReturningDelegate.releaseStatement(AbstractReturningDelegate.java:82)    at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:60)    ... 21 more06:44:48 [INFO]: plugin.java:196 - End plugin06:44:48 [ERROR]: AssertionFailure.java:45 - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)org.hibernate.AssertionFailure: null id in sherlock.common.dao.BatchLog entry (don't flush the Session after an exception occurs)    at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:82)    at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190)    at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147)    at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)    at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)    at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)    at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:88)    at com.caucho.transaction.TransactionImpl.callBeforeCompletion(TransactionImpl.java:843)    at com.caucho.transaction.TransactionImpl.commit(TransactionImpl.java:582)    at com.caucho.transaction.TransactionManagerImpl.commit(TransactionManagerImpl.java:271)    at com.caucho.jca.UserTransactionImpl.commit(UserTransactionImpl.java:436)    at com.caucho.jca.UserTransactionProxy.commit(UserTransactionProxy.java:167)    at sherlock.backend.job.AbstractPluginJobTask.endTransaction(AbstractPluginJobTask.java:126)    at sherlock.backend.job.AbstractPluginJobTask.run(AbstractPluginJobTask.java:202)    at framework.util.task.TaskEngine$TaskEngineWorker.run(TaskEngine.java:174)06:44:48 [ERROR]: AbstractPluginJobTask.java:135 - Couldn't commit!javax.transaction.RollbackException: org.hibernate.AssertionFailure: null id in sherlock.common.dao.BatchLog entry (don't flush the Session after an exception occurs)    at com.caucho.transaction.TransactionImpl.callBeforeCompletion(TransactionImpl.java:847)    at com.caucho.transaction.TransactionImpl.commit(TransactionImpl.java:582)    at com.caucho.transaction.TransactionManagerImpl.commit(TransactionManagerImpl.java:271)    at com.caucho.jca.UserTransactionImpl.commit(UserTransactionImpl.java:436)    at com.caucho.jca.UserTransactionProxy.commit(UserTransactionProxy.java:167)    at sherlock.backend.job.AbstractPluginJobTask.endTransaction(AbstractPluginJobTask.java:126)    at sherlock.backend.job.AbstractPluginJobTask.run(AbstractPluginJobTask.java:202)    at framework.util.task.TaskEngine$TaskEngineWorker.run(TaskEngine.java:174)Caused by: org.hibernate.AssertionFailure: null id in sherlock.common.dao.BatchLog entry (don't flush the Session after an exception occurs)    at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:82)    at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190)    at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147)    at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)    at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)    at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)    at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:88)    at com.caucho.transaction.TransactionImpl.callBeforeCompletion(TransactionImpl.java:843)    ... 7 more

最佳答案

不是真正的答案,但请查看:http://community.jboss.org/thread/170092 (如果你还没有看到那个帖子)

关于java - org.hibernate.exception.JDBCConnectionException : could not insert, 如何在生产环境中查找问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7362313/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com