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

    bpm:implementation.bpm marked as persistent fails

    edevera

      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?

        • 1. Re: bpm:implementation.bpm marked as persistent fails
          dward

          If you are using the JBoss AS7 server built and packaged in the download for SwitchYard 0.6.0.Final, you will not have to edit any of the modules, or add anything to any MANIFEST.MF file in your application.

           

          Looking at your persistence.xml file, I see a few things that are missing/wrong:

          1. A provider: <provider>org.hibernate.ejb.HibernatePersistence</provider>
          2. The datasource jndi syntax: <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
          3. The mapping file (already included in our jars, but you need to set it here): <mapping-file>JBPMorm-JPA2.xml</mapping-file>
          4. An incorrect jta tx mgr lookup class: <property name="hibernate.transaction.manager_lookup_class" value="org.switchyard.component.bpm.jta.hibernate.AS7TransactionManagerLookup"/>

           

          I think #3 is the biggest thing you are missing.

           

          You are also missing some audit classes mapped, but I don't think that will cause an issue.

           

          Please use the quickstarts/demos/helpdesk-webapp/src/main/resources/META-INF/persistence.xml file as an example to follow.

           

          Hope this helps,

          David

          • 2. Re: bpm:implementation.bpm marked as persistent fails
            edevera

            Thanks for your help. It worked well after having changed the things you mentioned. Specially useful was the mapping file as well as the transactiona manager lookup.

            • 3. Re: bpm:implementation.bpm marked as persistent fails
              dward

              Glad to hear it!