'Protocol violation exception in Java application
We have an application developed in java(jdk1.5 and DB is oracle 10g). At some point of time our application is giving below error and terminating. I had searched in the internet and all forums says that "this could be the driver issue (compatibility between oracle JDBC driver and DB). To resolve this we need to upgrade or we need to replace some latest version of jar files". But if I restart my application, it started working fine. I am getting this error very rarely. If it is really an driver issue, then it should not work when I restart my application.
I would like to understand that, in which scenario it can happen, since it is not happening every time.
Can any one help me on this?
Error Logs From my application:
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
Solution 1:[1]
I would start by upgrading your JDBC driver, and looking for class12.jar in your classpath. I also found this link that might help: https://forums.oracle.com/message/9710491
Solution 2:[2]
We had same issue. We replaced ojdbc7.jar with ojdbc8.jar and it resolved issue. Our hibernate version was 4.x.
This is caused due to CLOB field in your database, other option is to add space or extra character to your data. More information here https://community.oracle.com/thread/3647914
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mike |
Solution 2 |