Java应用程序中的协议违规异常

时间:2013-08-27 05:19:52

标签: java jdbc oracle10g protocols

我们有一个用java开发的应用程序(jdk1.5和DB是oracle 10g)。在某些时候,我们的应用程序提供以下错误并终止。我曾在互联网上搜索,所有论坛都说“这可能是驱动程序问题(oracle JDBC驱动程序和数据库之间的兼容性)。要解决这个问题,我们需要升级或者需要更换一些最新版本的jar文件”。但是,如果我重新启动我的应用程序,它开始工作正常我很少得到这个错误。如果它确实是一个驱动程序问题,那么当我重新启动我的应用程序时它不应该工作。

我想理解,在哪种情况下它可能发生,因为它不会每次都发生。

任何人都能帮助我吗?

错误记录来自我的应用程序:

SQL Error: 17401, SQLState: null
Protocol violation
SQL Error: 17401, SQLState: null
Protocol violation
SQL Error: 17401, SQLState: null
Protocol violation
Rollback failed
java.sql.SQLException: Protocol violation
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.j ava:1160)
at oracle.jdbc.ttc7.Ocommoncall.receive(Ocommoncall.j ava:149)
at oracle.jdbc.ttc7.TTC7Protocol.rollback(TTC7Protoco l.java:488)
at oracle.jdbc.driver.OracleConnection.rollback(Oracl eConnection.java:1412)
at net.sf.hibernate.transaction.JDBCTransaction.rollb ack(JDBCTransaction.java:86)
at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:90)
at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:59)
at com.azure.spark.database.hibernate.util.HibernateU til.get(HibernateUtil.java:569)
at com.azure.spark.database.hibernate.util.HibernateS ession.get(HibernateSession.java:340)
at com.azure.spark.taskcontroller.TaskControllerCompo nent.taskCompleted(TaskControllerComponent.java:11 54)
at com.azure.spark.taskcontroller.TaskControllerCompo nent.onTaskEvent(TaskControllerComponent.java:1111 )
at com.azure.spark.taskcontroller.tasks.AbstractTaskC omponent.run(AbstractTaskComponent.java:354)
at java.lang.Thread.run(Thread.java:637)
Error rolling back transaction
net.sf.hibernate.TransactionException: Rollback failed with SQL exception: 
at net.sf.hibernate.transaction.JDBCTransaction.rollb ack(JDBCTransaction.java:91)
at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:90)
at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:59)
at com.azure.spark.database.hibernate.util.HibernateU til.get(HibernateUtil.java:569)
at com.azure.spark.database.hibernate.util.HibernateS ession.get(HibernateSession.java:340)
at com.azure.spark.taskcontroller.TaskControllerCompo nent.taskCompleted(TaskControllerComponent.java:11 54)
at com.azure.spark.taskcontroller.TaskControllerCompo nent.onTaskEvent(TaskControllerComponent.java:1111 )
at com.azure.spark.taskcontroller.tasks.AbstractTaskC omponent.run(AbstractTaskComponent.java:354)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.sql.SQLException: Protocol violation
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.j ava:1160)
at oracle.jdbc.ttc7.Ocommoncall.receive(Ocommoncall.j ava:149)
at oracle.jdbc.ttc7.TTC7Protocol.rollback(TTC7Protoco l.java:488)
at oracle.jdbc.driver.OracleConnection.rollback(Oracl eConnection.java:1412)
at net.sf.hibernate.transaction.JDBCTransaction.rollb ack(JDBCTransaction.java:86)
... 8 more
Error setting task status to completed
net.sf.hibernate.HibernateException: Error attempting to do session work
at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:96)
at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:59)
at com.azure.spark.database.hibernate.util.HibernateU til.get(HibernateUtil.java:569)
at com.azure.spark.database.hibernate.util.HibernateS ession.get(HibernateSession.java:340)
at com.azure.spark.taskcontroller.TaskControllerCompo nent.taskCompleted(TaskControllerComponent.java:11 54)
at com.azure.spark.taskcontroller.TaskControllerCompo nent.onTaskEvent(TaskControllerComponent.java:1111 )
at com.azure.spark.taskcontroller.tasks.AbstractTaskC omponent.run(AbstractTaskComponent.java:354)
at java.lang.Thread.run(Thread.java:637)
Caused by: net.sf.hibernate.exception.GenericJDBCException: could not load: [com.azure.spark.database.hibernate.mappings.refere nce.impl.TaskImpl#43176610]
at net.sf.hibernate.exception.ErrorCodeConverter.hand ledNonSpecificException(ErrorCodeConverter.java:90 )
at net.sf.hibernate.exception.ErrorCodeConverter.conv ert(ErrorCodeConverter.java:79)
at net.sf.hibernate.exception.JDBCExceptionHelper.con vert(JDBCExceptionHelper.java:30)
at net.sf.hibernate.persister.AbstractEntityPersister .convert(AbstractEntityPersister.java:1332)
at net.sf.hibernate.persister.EntityPersister.load(En tityPersister.java:418)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionIm pl.java:2130)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(Se ssionImpl.java:2027)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl. java:1936)
at com.azure.spark.database.hibernate.util.HibernateU til$11.doSessionWork(HibernateUtil.java:573)
at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:80)
... 7 more
Caused by: java.sql.SQLException: Protocol violation
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.j ava:1160)
at oracle.jdbc.ttc7.Oclose.receive(Oclose.java:133)
at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.j ava:684)
at oracle.jdbc.driver.OracleStatement.close(OracleSta tement.java:700)
at oracle.jdbc.driver.OraclePreparedStatement.private Close(OraclePreparedStatement.java:489)
at oracle.jdbc.driver.OraclePreparedStatement.close(O raclePreparedStatement.java:396)
at net.sf.hibernate.impl.BatcherImpl.closePreparedSta tement(BatcherImpl.java:273)
at net.sf.hibernate.impl.BatcherImpl.closeStatement(B atcherImpl.java:141)
at net.sf.hibernate.impl.BatcherImpl.closeQueryStatem ent(BatcherImpl.java:157)
at net.sf.hibernate.impl.BatcherImpl.closeQueryStatem ent(BatcherImpl.java:104)
at net.sf.hibernate.loader.Loader.getResultSet(Loader .java:884)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java :269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializ eNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.j ava:911)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.j ava:931)
at net.sf.hibernate.loader.EntityLoader.load(EntityLo ader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLo ader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(En tityPersister.java:415)
... 12 more

2 个答案:

答案 0 :(得分:0)

首先,我将升级您的JDBC驱动程序,并在类路径中查找class12.jar。我还发现了这个可能有用的链接:https://forums.oracle.com/message/9710491

答案 1 :(得分:0)

我们有同样的问题。 我们用ojdbc8.jar替换了ojdbc7.jar,它解决了问题。 我们的hibernate版本是4.x。

这是由于数据库中的CLOB字段引起的,其他选项是为数据添加空格或额外字符。 更多信息,请https://community.oracle.com/thread/3647914