3 Replies Latest reply on Aug 20, 2010 10:51 AM by William Crowell

    jBPM 4.4 on sybase

    Dino Trump Newbie

      I get this error when I´m deploying a process definition on sybase 12.5.2

       

       

      ADVERTENCIA: SQL Error: 0, SQLState: JZ006
      GRAVE: JZ006: Se ha detectado IOException: java.io.IOException: JZ0SL: Tipo SQL no admitido: 2005.
      GRAVE: Could not synchronize database state with session
      org.hibernate.exception.GenericJDBCException: could not insert: [org.jbpm.pvm.internal.repository.DeploymentImpl]
          at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
          at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
          at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2295)
          at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2688)
          at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
          at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
          at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
          at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
          at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
          at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
          at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)
          at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1141)
          at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
          at org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java:93)
          at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:67)
          at org.jbpm.pvm.internal.query.AbstractQuery.untypedList(AbstractQuery.java:67)
          at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.list(ProcessDefinitionQueryImpl.java:157)
          at org.jbpm.pvm.internal.repository.ProcessDeployer.checkKey(ProcessDeployer.java:133)
          at org.jbpm.pvm.internal.repository.ProcessDeployer.deploy(ProcessDeployer.java:92)
          at org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:46)
          at org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:62)
          at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
          at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
          at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
          at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)
          at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
          at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:49)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
          at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)
          at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:90)


      Caused by: java.sql.SQLException: JZ006: Se ha detectado IOException: java.io.IOException: JZ0SL: Tipo SQL no admitido: 2005.
          at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
          at com.sybase.jdbc3.jdbc.ErrorMessage.raiseErrorCheckDead(Unknown Source)
          at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
          at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
          at com.sybase.jdbc3.tds.Tds.language(Unknown Source)
          at com.sybase.jdbc3.jdbc.SybStatement.sendQuery(Unknown Source)
          at com.sybase.jdbc3.jdbc.SybPreparedStatement.sendQuery(Unknown Source)
          at com.sybase.jdbc3.jdbc.SybStatement.executeUpdate(Unknown Source)
          at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeUpdate(Unknown Source)
          at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:46)
          at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2275)
          ... 113 more


      GRAVE: JDBC rollback failed
      com.sybase.jdbc3.jdbc.SybSQLException: A wrong datastream has been sent to the server. The server was expecting token 32 but got the token 33. This is an internal error.
          at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
          at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
          at com.sybase.jdbc3.tds.Tds.new(Unknown Source)
          at com.sybase.jdbc3.tds.Tds.doCommand(Unknown Source)
          at com.sybase.jdbc3.tds.Tds.endTransaction(Unknown Source)
          at com.sybase.jdbc3.jdbc.SybConnection.rollback(Unknown Source)
          at com.sybase.jdbc3.jdbc.SybConnectionProxy.rollback(Unknown Source)
          at com.sun.gjc.spi.base.ConnectionHolder.rollback(ConnectionHolder.java:603)
          at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217)
          at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196)
          at org.springframework.orm.hibernate3.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:676)
          at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:845)
          at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:822)
          at org.springframework.transaction.support.TransactionTemplate.rollbackOnException(TransactionTemplate.java:161)
          at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:134)
          at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:49)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
          at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)
          at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:90)

       

      It is necesary to change hibernate mappings ?

        • 1. Re: jBPM 4.4 on sybase
          Alejandro Guizar Master

          Dino, this is an issue with the JConnect driver. Even though jBPM 4.4 is not tested with Sybase,  jBPM 3.2 is, and I recognized the issue instantly. The problem is described in the heading comment of this source file:

          work around a "feature" in the jConnect driver when setting a text parameter to null.
          Specifically, the call:

          PreparedStatement st;
          st.setNull(index, Types.CLOB);

          throws an SQLException with SQL state "JZ0SL" and reason "Unsupported SQL type".

          Unfortunately the workaround is not straightforward. On the one hand you can switch to jTDS, unfortunately it does not support XA transactions for Sybase. If that is not a problem for you, go ahead and try that driver. Otherwise, you can try the jBPM3 solution. Add SybaseTextType.java to your application. Next, create a Hibernate mapping file with the following content, and reference it from your Hibernate configuration file before other mapping files.

          <?xml version="1.0"?>
          <!DOCTYPE hibernate-mapping PUBLIC
                "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
          <hibernate-mapping>
            <typedef name="text" class="org.jbpm.db.hibernate.SybaseTextType" />
          </hibernate-mapping>

          This will make any field/property mapped to a text column employ SybaseTextType instead of the standard org.hibernate.type.TextType, thus avoiding the specific call that breaks jConnect. This solution will eventually make it to jBPM4 but in the meantime, please apply it yourself.

          • 2. Re: jBPM 4.4 on sybase
            Dino Trump Newbie

            Hi Alejandro.

             

            Thank you for your help, I switched to jDTS and the result was ok, but I''ll try the jbpm 3 solution on jbpm 4.

             

            Greetings

            • 3. Re: jBPM 4.4 on sybase
              William Crowell Newbie

              I have the same issue.  I can't move to another driver though.  Here is what I have run into:

               

              I am running into a problem with a simple database row insert into Sybase.

              I could see others running into the same problem since we use the same  jconn3 driver.

              I am using iBatis 2.3.4.726 (the last version of iBatis 2), Sybase Thin  jconn3 version 6.5 drivers, and JUnit 4 on Java 1.6.

              The problem is that you can't insert into a table if there are more than  2 text/varchar columns defined in the table.

              For instance if you have a table like this:

               

              CREATE TABLE section(
              id INTEGER IDENTITY PRIMARY KEY,
              name text, 
              summary text,
              description text
              )

               

              And you try the configuration above, you receive the following error:

              com.sybase.jdbc3.jdbc.SybSQLException: A wrong datastream has been sent  to the server. The server was expecting token 32 but got the
              token 33. This  is an internal error.

                      at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
                      at  com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
                      at  com.sybase.jdbc3.tds.Tds.new(Unknown Source)
                      at  com.sybase.jdbc3.tds.Tds.doCommand(Unknown Source)
                      at  com.sybase.jdbc3.tds.Tds.endTransaction(Unknown Source)
                      at  com.sybase.jdbc3.jdbc.SybConnection.rollback(Unknown Source)
              ...
                       at com.ibatis.common.jdbc.SimpleDataSource  $SimplePooledConnection.invoke(SimpleDataSource.java:958) ...
                       at  com.ibatis.common.jdbc.logging.ConnectionLogProxy.invoke(ConnectionLogProxy.java:  68)
              ...
                      at  com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.rollback(JdbcTransaction.java:  72)
                      at  com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:  87)
                      at  com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:  734)
                      at  com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:  176)
                      at  com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:  153)
                      at  com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:  835)
                      at  com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:  410)       

                      at  com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:  82)
                      at  com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:  58)
                      at  com.xxxxxxxxxxx.dao.SectionDAO.createSection(SectionDAO.java:75)
                      at  com.xxxxxxxxxxx.model.SectionTest.testContext(SectionTest.java:34)
              ...
                       at  org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:  160)

               

              Now change the table definition to leave out the description field to 
              this:

              CREATE TABLE section(
              id INTEGER IDENTITY PRIMARY KEY,
              name text, 
              summary text
              )

              Then the table insert happens.

              There is not much on Google for the "The server was expecting token 32  but got the token 33" exception.

               

              http://www.talendforge.org/bugs/view.php?id=13087&nbn=2
              http://www.google.com/url?sa=D&q=http://comments.gmane.org/gmane.comp.java.ibatisdb.user/39&usg=AFQjCNHMPIMTaPh--M1CKqEQ6NJZGi8h6Q

              http://comments.gmane.org/gmane.comp.java.ibatisdb.user/39

               

              I see a bug was opened up on it on the old iBatis' Apache Support site:

              http://osdir.com/ml/db.ibatis.devel/2006-04/msg00036.html

              But the bug was closed prematurely by Larry Meadors with iBatis
              because  they moved to Google Groups myBatis.