1 Reply Latest reply on May 1, 2014 5:42 PM by Marco Rietveld

    jBPM6 persistence using OpenJPA

    Eleni Giannakopoulou Newbie

      Hello.. I am trying to test jBPM6 persistence using OpenJPA and MySQL database. The version of the jBPM that I am using is the 6.0.1.Final.

      I have already tried it using Hibernate where the persistence in my database was successful. But when I change the persistence.xml and use the settings for OpenJPA,

      I am getting several exceptions.

       

      At first, I would like to ask if there are specific instructions somewhere or any other discussions referring to using jBPM with OpenJPA which could be helpful.

       

      The persistence unit in my persistence.xml that I use is the following:

       

      <persistence-unit name="drools.persistence.test.pu" transaction-type="JTA">

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

       

              <mapping-file>META-INF/JBPMorm.xml</mapping-file>

              <mapping-file>META-INF/Taskorm.xml</mapping-file> 

       

              <class>org.drools.persistence.info.SessionInfo</class>

              <class>org.drools.persistence.info.WorkItemInfo</class>

             

              <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>       

              <class>org.jbpm.persistence.correlation.CorrelationKeyInfo</class>

              <class>org.jbpm.persistence.correlation.CorrelationPropertyInfo</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.runtime.manager.impl.jpa.ContextMappingInfo</class>

              <class>org.jbpm.services.task.impl.model.AttachmentImpl</class>

              <class>org.jbpm.services.task.impl.model.ContentImpl</class>

              <class>org.jbpm.services.task.impl.model.BooleanExpressionImpl</class>

              <class>org.jbpm.services.task.impl.model.CommentImpl</class>

              <class>org.jbpm.services.task.impl.model.DeadlineImpl</class>

              <class>org.jbpm.services.task.impl.model.DelegationImpl</class>

              <class>org.jbpm.services.task.impl.model.EscalationImpl</class>

              <!--  <class>org.jbpm.services.task.impl.model.GroupImpl</class> it throws ClassNotFound exception in OpenJPA -->

              <class>org.jbpm.services.task.impl.model.I18NTextImpl</class>

              <class>org.jbpm.services.task.impl.model.NotificationImpl</class>

              <class>org.jbpm.services.task.impl.model.EmailNotificationImpl</class>

              <class>org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl</class>

              <class>org.jbpm.services.task.impl.model.PeopleAssignmentsImpl</class>

              <class>org.jbpm.services.task.impl.model.ReassignmentImpl</class>

              <class>org.jbpm.services.task.impl.model.TaskImpl</class>

              <class>org.jbpm.services.task.impl.model.TaskDataImpl</class>

              <!-- <class>org.jbpm.services.task.impl.model.UserImpl</class> it throws ClassNotFound exception in OpenJPA -->

              <class>org.jbpm.services.task.impl.model.BAMTaskSummaryImpl</class>   

              <!-- Event Classes -->

              <class>org.jbpm.services.task.audit.TaskEventImpl</class>

              <exclude-unlisted-classes>true</exclude-unlisted-classes>

       

              <properties>

                  <!--  these properties work for hibernate

                  <property name="hibernate.max_fetch_depth" value="3"/>

                   <property name="hibernate.hbm2ddl.auto" value="update" />

                    <property name="hibernate.show_sql" value="true" />   

                    <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.BitronixJtaPlatform" />

                    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>

                    <property name="hibernate.id.new_generator_mappings" value="false"/> -->

       

                  <property name="openjpa.Log" value="log4j" />

                  <property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrintParameters=true" />

                  <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='add,deleteTableContents', ForeignKeys=true)" />

       

                  <!-- OpenJPA / Chapter 8. Deployment / 2. Integrating with the Transaction Manager -->

                  <property name="openjpa.TransactionMode" value="managed" />

                  <property name="openjpa.ManagedRuntime" value="invocation(TransactionManagerMethod=bitronix.tm.TransactionManagerServices.getTransactionManager)" />

                 

                  <!-- OpenJPA / Chapter 4. JDBC / 2. Using a Third-Party DataSource / 2.1. Managed and XA DataSources -->

                  <!-- use OpenJPA's built-in DataSource for unmanaged connections -->

                  <property name="openjpa.Connection2DriverName" value="com.mysql.jdbc.Driver" />

                  <property name="openjpa.Connection2URL" value="jdbc:mysql://localhost/jbpm_test" />

              </properties>

          </persistence-unit>

       

      The following exception is an example of the exceptions that I am getting...

       

      18:51:55,961 WARN : openjpa.Enhance - An exception was thrown while attempting to perform class file transformation on "org/jbpm/persistence/correlation/CorrelationPropertyInfo":

      <openjpa-2.2.2-r422266:1468616 fatal user error> org.apache.openjpa.util.MetaDataException: "org.jbpm.persistence.correlation.CorrelationPropertyInfo.id" declares generator name "correlationPropertyInfoIdSeq", but uses the AUTO generation type.  The only valid generator names under AUTO are "uuid-hex" and "uuid-string".

          at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.getGeneratedValueStrategy(AnnotationPersistenceMetaDataParser.java:1413)

          at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseGeneratedValue(AnnotationPersistenceMetaDataParser.java:1368)

          at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseGeneratedValue(AnnotationPersistenceMetaDataParser.java:1360)

          at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseMemberAnnotations(AnnotationPersistenceMetaDataParser.java:1220)

          at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:690)

          at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:415)

          at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:260)

          at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:586)

          at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:396)

          at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:388)

          at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:286)

          at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:257)

          at org.apache.openjpa.enhance.PCClassFileTransformer.transform0(PCClassFileTransformer.java:146)

          at org.apache.openjpa.enhance.PCClassFileTransformer.transform(PCClassFileTransformer.java:126)

          at sun.instrument.TransformerManager.transform(TransformerManager.java:188)

          at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)

          at java.lang.ClassLoader.defineClass1(Native Method)

          at java.lang.ClassLoader.defineClass(ClassLoader.java:800)

          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

          at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

          at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

          at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

          at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

          at java.security.AccessController.doPrivileged(Native Method)

          at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

          at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

          at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

          at java.lang.Class.forName0(Native Method)

          at java.lang.Class.forName(Class.java:270)

          at org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1558)

          at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1534)

          at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1512)

          at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1492)

          at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:141)

          at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)

          at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)

          at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209)

          at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)

          at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)

          at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)

          at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)

          at org.drools.persistence.jpa.AbstractPersistenceContextManager.getApplicationScopedEntityManager(AbstractPersistenceContextManager.java:78)

          at org.drools.persistence.jpa.JpaPersistenceContextManager.getApplicationScopedPersistenceContext(JpaPersistenceContextManager.java:61)

          at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:118)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

          at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)

          at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newKieSession(KnowledgeStoreServiceImpl.java:67)

          at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newKieSession(KnowledgeStoreServiceImpl.java:36)

          at org.kie.internal.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:121)

          at org.jbpm.runtime.manager.impl.factory.JPASessionFactory.newKieSession(JPASessionFactory.java:41)

          at org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager.init(PerProcessInstanceRuntimeManager.java:276)

          at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl.newPerProcessInstanceRuntimeManager(RuntimeManagerFactoryImpl.java:104)

          at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl.newPerProcessInstanceRuntimeManager(RuntimeManagerFactoryImpl.java:95)

          at com.eurodyn.qlack2.incubator.drools.persistence.PersistenceTest.testPersistenceJBPM(PersistenceTest.java:80)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:606)

          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)

          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)

          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

          at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

          at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)

          at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)

          at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:606)

          at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)

          at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)

          at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)

          at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)

          at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)

       

      Any ideas or suggestions would be much appreciated.

       

      Thanks,

      Eleni.

        • 1. Re: jBPM6 persistence using OpenJPA
          Marco Rietveld Novice

          Hi Eleni,

           

          There has been a demand for OpenJPA support from the community for some time, but unfortunately, I haven't had the time to add support for it. Some members have forked the source code and then been able to modify the code to support it: I believe the necessary changes consist mostly of changes to the entity classes (JPA annotation tweaks).

           

          At the moment, we only support hibernate 4 with drools/jbpm. I'm hoping to add OpenJPA compatibility by the end of the 2014.

           

          Thanks,

          Marco