3 Replies Latest reply on Nov 26, 2012 11:29 AM by David Ward

    bpm:implementation.bpm marked as persistent fails

    Eduardo de Vera Toquero Newbie

      When using the implementation.bpm element in a switchyard configuration file marked as persistent="true" as shown below:

      {code}

      ...

            <bpm:implementation.bpm requires="managedTransaction.Global" processDefinition="ProcessComponent.bpmn" processId="HelloBPMWorld" persistent="true">

              <bpm:taskHandler name="SwitchYard Service" class="org.switchyard.component.bpm.task.work.SwitchYardServiceTaskHandler"/>

            </bpm:implementation.bpm>

      ...

      {code}

       

      I get the following error:

       

      {code}

      12:21:41,515 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-11) MSC00001: Failed to start service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: javax.persistence.PersistenceException: No Persistence provider for EntityManager named org.jbpm.persistence.jpa

                at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:79)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_37]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_37]

                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_37]

      Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named org.jbpm.persistence.jpa

                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)

                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)

                at org.switchyard.component.bpm.exchange.drools.DroolsBPMExchangeHandler.init(DroolsBPMExchangeHandler.java:178)

                at org.switchyard.component.bpm.deploy.BPMActivator.activateService(BPMActivator.java:61)

                at org.switchyard.deploy.internal.Deployment.deployImplementations(Deployment.java:459)

                at org.switchyard.deploy.internal.Deployment.start(Deployment.java:140)

                at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:106)

                at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:72)

                ... 5 more

      {code}

       

      If I try adding a persistence.xml file to my application such as the following one:

       

      {code}

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.0"

         xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="

              http://java.sun.com/xml/ns/persistence

              http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

        <persistence-unit name="org.jbpm.persistence.jpa">

                          <provider>org.hibernate.ejb.HibernatePersistence</provider>

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

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

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

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

        <properties>

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

        <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.manager_lookup_class"

                                                          value="org.hibernate.transaction.BTMTransactionManagerLookup" />

        </properties>

        </persistence-unit>

      </persistence>

      {code}

       

      I get the following error:

       

      {code}

      12:29:24,975 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-10) MSC00001: Failed to start service jboss.persistenceunit."switchyard-example.jar#org.jbpm.persistence.jpa": org.jboss.msc.service.StartException in service jboss.persistenceunit."switchyard-example.jar#org.jbpm.persistence.jpa": Failed to start service

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_37]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_37]

                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_37]

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] class or package not found

                at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1400)

                at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1183)

                at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1047)

                at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:692)

                at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72)

                at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

                at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                ... 3 more

      Caused by: java.lang.ClassNotFoundException: org.drools.persistence.session.SessionInfo from [Module "org.hibernate:main" from local module loader @6da28362 (roots: /Applications/switchyard-as7-0.6/modules)]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

                at java.lang.Class.forName0(Native Method) [classes.jar:1.6.0_37]

                at java.lang.Class.forName(Class.java:247) [classes.jar:1.6.0_37]

                at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:170)

                at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1317)

                at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1389)

                ... 11 more

       

      {code}

       

      A class path problem pointing to the application not being able to find the mentioned class. I have tried adding the org.drools module to my manifest.mf file as a dependency as explained by JBoss Modules documentation (and JBoss AS 7). Since the JBoss instance I am using is the switchyard-0.6.Final one, and drools modules are where they belong. I have tried by adding a Dependencies: entry in my manifest:

       

      {code}

      Dependencies: org.drools

      {code}

       

      But still JBoss is unable to find the entities.

       

      So, how do I run persistent processes with SwitchYard?