4 Replies Latest reply on Jan 4, 2014 9:06 AM by Ramesh Routray

    Error while creating JBPM KnowledgeSession with Oracle DB Migration

    Ramesh Routray Newbie

      I am integrating oracle database with jbpm 5 instead of using its own h2 database. While creating KnowledgeSession it generates error as "A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property". I hope I have specified the driver class name in the persistence.xml. Issue Details are here below.

      Another thing I noticed. If I change the persistence provider to "org.hibernate.ejb.HibernatePersistence", it shows the error as: "unrecognized persistence provider "org.hibernate.ejb.HibernatePersistence" in place of OpenJPA provider.  This provider's properties will not be used.". But the control moves to next line and next error it shows while connecting to task client as "java.lang.IllegalArgumentException: Could not connect task client".

      Can anybody please help me understand and resolve the issue?

      jbpm 5.4

      eclipse juno sr1
      websphere 7
      oracle 10g

       

      Code for knowledgesession creation:

      EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );
      Environment env = KnowledgeBaseFactory.newEnvironment();
      System.out.println(emf);
      System.out.println(EnvironmentName.ENTITY_MANAGER_FACTORY);
      env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
      env.set( EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager() );
      env.set( EnvironmentName.GLOBALS, new MapGlobalResolver() );

      Properties properties = new Properties();
      properties.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
      properties.put("drools.processSignalManagerFactory", "org.jbpm.persistence.processinstance.JPASignalManagerFactory");
      KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
      System.out.println("config ** "+config);
      System.out.println("kbase ** "+kbase);
      System.out.println("env ** "+env);
      System.out.println("env transaction manager: "+env.get("drools.transaction.TransactionManager"));
      StatefulKnowledgeSession newStatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase,config,env);

      return newStatefulKnowledgeSession;


      persistence.xml:

      <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
      <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>

      <jta-data-source>jdbc/jbpmDS</jta-data-source>

      <class>org.drools.persistence.info.SessionInfo</class>
      <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
      <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
      <class>org.drools.persistence.info.WorkItemInfo</class>
      <class>org.jbpm.process.audit.ProcessInstanceLog</class>
      <class>org.jbpm.process.audit.NodeInstanceLog</class>
      <class>org.jbpm.process.audit.VariableInstanceLog</class> 
      <class>org.jbpm.task.Task</class>
      <class>org.jbpm.task.Comment</class>
      <class>org.jbpm.task.Attachment</class>
      <class>org.jbpm.task.I18NText</class>
      <class>org.jbpm.task.SubTasksStrategy</class>
      <class>org.jbpm.task.Deadline</class>
      <class>org.jbpm.task.Escalation</class>
      <class>org.jbpm.task.Reassignment</class>
      <class>org.jbpm.task.Notification</class>
      <class>org.jbpm.task.BooleanExpression</class>
      <class>org.jbpm.task.User</class>
      <class>org.jbpm.task.PeopleAssignments</class>

      <properties> 
        <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
        <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="hibernate.connection.url" value="jdbc:oracle:thin:@131.131.131.131:1521:abcd" />
        <property name="hibernate.connection.username" value="abcdef"/>
        <property name="hibernate.connection.password" value="abcdef"/> 
        <property name="hibernate.connection.autocommit" value="false"/>
        <property name="hibernate.max_fetch_depth" value="3"/>
        <property name="hibernate.hbm2ddl.auto" value="update" />
        <property name="hibernate.show_sql" value="true" />
      </properties>
      </persistence-unit>

      <persistence-unit name="org.jbpm.task">
      <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> 

      <class>org.jbpm.task.Attachment</class>
      <class>org.jbpm.task.Content</class>
      <class>org.jbpm.task.BooleanExpression</class>
      <class>org.jbpm.task.Comment</class>
      <class>org.jbpm.task.Deadline</class>
      <class>org.jbpm.task.Comment</class>
      <class>org.jbpm.task.Deadline</class>
      <class>org.jbpm.task.Delegation</class>
      <class>org.jbpm.task.Escalation</class>
      <class>org.jbpm.task.Group</class>
      <class>org.jbpm.task.I18NText</class>
      <class>org.jbpm.task.Notification</class>
      <class>org.jbpm.task.EmailNotification</class>
      <class>org.jbpm.task.EmailNotificationHeader</class>
      <class>org.jbpm.task.PeopleAssignments</class>
      <class>org.jbpm.task.Reassignment</class>
      <class>org.jbpm.task.Status</class>
      <class>org.jbpm.task.Task</class>
      <class>org.jbpm.task.TaskData</class>
      <class>org.jbpm.task.SubTasksStrategy</class>
      <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
      <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
      <class>org.jbpm.task.User</class>
      <class>org.drools.persistence.info.SessionInfo</class>
      <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
      <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
      <class>org.drools.persistence.info.WorkItemInfo</class>

      <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
        <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="hibernate.connection.url" value="jdbc:oracle:thin:@131.131.131.131:1521:abcd" />
        <property name="hibernate.connection.username" value="abcdef"/>
        <property name="hibernate.connection.password" value="abcdef"/> 
        <property name="hibernate.connection.autocommit" value="false"/>
        <property name="hibernate.max_fetch_depth" value="3"/>
        <property name="hibernate.hbm2ddl.auto" value="update" />
        <property name="hibernate.show_sql" value="true" />
      </properties>
      </persistence-unit>
      </persistence>


      Error Log:


      SystemOut O com.ibm.ws.persistence.EntityManagerFactoryImpl@3fb23fb2
      SystemOut O drools.persistence.jpa.EntityManagerFactory
      SystemOut O config ** org.drools.SessionConfiguration@665f665f
      SystemOut O kbase ** org.drools.impl.KnowledgeBaseImpl@48df48df
      SystemOut O env ** org.drools.impl.EnvironmentImpl@4b4b4b4b
      SystemOut O env transaction manager: a BitronixTransactionManager with 0 in-flight transaction(s)
      SystemOut O 11 org.jbpm.persistence.jpa INFO [WebContainer : 0] openjpa.Runtime - Starting OpenJPA 1.2.3-SNAPSHOT
      SystemErr R java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
      SystemErr R at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:142)
      SystemErr R at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:66)
      SystemErr R at org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:122)
      SystemErr R at com.sample.execute.MigrateDB.createKnowledgeSession(MigrateDB.java:99)
      SystemErr R at com.sample.execute.MigrateDB.dbMIgration(MigrateDB.java:42)
      SystemErr R at com.servlets.AServlet.doPost(AServlet.java:41)
      SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
      SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
      SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
      SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
      SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
      SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
      SystemErr R at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3935)
      SystemErr R at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
      SystemErr R at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
      SystemErr R at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
      SystemErr R at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
      SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
      SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
      SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
      SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
      SystemErr R at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      SystemErr R at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      SystemErr R at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      SystemErr R at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
      SystemErr R at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
      SystemErr R at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
      SystemErr R at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
      SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
      SystemErr R Caused by: java.lang.reflect.InvocationTargetException
      SystemErr R at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      SystemErr R at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:45)
      SystemErr R at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
      SystemErr R at java.lang.reflect.Constructor.newInstance(Constructor.java:515)
      SystemErr R at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:128)
      SystemErr R ... 28 more
      SystemErr R Caused by: <openjpa-1.2.3-SNAPSHOT-r422266:1152904 fatal user error> org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
      SystemErr R at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:74)
      SystemErr R at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:784)
      SystemErr R at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:561)
      SystemErr R at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1344)
      SystemErr R at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
      SystemErr R at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
      SystemErr R at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
      SystemErr R at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
      SystemErr R at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
      SystemErr R at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:863)
      SystemErr R at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:854)
      SystemErr R at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:638)
      SystemErr R at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:183)
      SystemErr R at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
      SystemErr R at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
      SystemErr R at com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:42)
      SystemErr R at com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:27)
      SystemErr R at org.drools.persistence.jpa.JpaPersistenceContextManager.getApplicationScopedPersistenceContext(JpaPersistenceContextManager.java:55)
      SystemErr R at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:144)
      SystemErr R ... 33 more