4 Replies Latest reply on Jul 11, 2012 4:18 PM by Adrian Apthorp

    JBPM Console Process List Error (No Persistence provider for EntityManager named org.jbpm.persistence.jpa)

    Newbie

      Hi


      I've tried installing JBPM console 5.2 (downloaded war) and 5.3 (compiled myself with maven) at separate times.  I am running in JBoss AS 7.0.2.

       

      In both cases I changed the login provider to be JAAS filesystem based/container managed.  I also changed the persistence to use MySQL through a JNDI datasource.

       

      If anyone has any ideas it would be much, much appreciated.  I just want to see my process in the web UI console.  Please . Please will someone kindly point me at a fix for my error.

      Dom4j Error

      In both versions I get:

      Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory Nested exception: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

      when deploying jbpm-gwt-console-server.  To remedy this, I removed both dom4j jars (1.6 and 1.6.1) from WEB-INF/lib in the jbpm-gwt-console-server.  This lets me get past deployment.

       

      I can log in to JBPM console server with no errors.  I get an error in rendering the task pane, but that seems to go away after the first time it renders.  I would paste it here, but the error has not occurred since I set the process pane to be default on login.

       

      Errors in Console Server Process Pane

      I navigate to the process pane, hit refresh, and in both versions (5.2 and 5.3) I get an error.

       

      5.2 gives this error:

       

      19:03:49,119 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/gwt-console-server].[Resteasy]] (http--0.0.0.0-8080-7) Servlet.service() for servlet Resteasy threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Could not initialize stateful knowledge session: No Persistence provider for EntityManager named org.jbpm.persistence.jpa

       

      5.3 gives this error:

       

      21:51:50,067 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/gwt-console-server].[Resteasy]] (http--0.0.0.0-8080-4) Servlet.service() for servlet Resteasy threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: Could not initialize class org.jbpm.integration.console.StatefulKnowledgeSessionUtil$SessionHolder

       

      Persistence Config

      In both cases Hibernate is set to create the database, and the tables do get created.  I also set showsql to true, and I can see the database being created.

      hibernate.cfg.xml

      In the jbpm-gwt-console-server jar my WEB-INF/classes/META-INF/hibernate.cfg.xml looks like this:

       

      <?xml version='1.0' encoding='utf-8'?>

      <!DOCTYPE hibernate-configuration PUBLIC

              "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

              "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

      <hibernate-configuration>

          <session-factory>

              <!-- Database connection settings -->

              <property name="connection.datasource">java:jboss/datasources/jbpm</property>

              <!-- JDBC connection pool (use the built-in) -->

              <property name="connection.pool_size">1</property>

              <!-- SQL dialect -->

              <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

              <!-- Enable Hibernate's automatic session context management -->

              <property name="current_session_context_class">thread</property>

              <!-- Disable the second-level cache  -->

              <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

              <!-- Echo all executed SQL to stdout -->

              <property name="show_sql">true</property>

              <!-- Drop and re-create the database schema on startup -->

              <property name="hbm2ddl.auto">create</property>

              <mapping resource="AuditLog.hbm.xml"/>

          </session-factory>

      </hibernate-configuration>

       

      persistence.xml

      and my WEB-INF/classes/META-INF/persistence.xml looks like this (5.2):

       

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

      <persistence version="1.0"

                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence

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

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

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

                   xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"

                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                   xmlns="http://java.sun.com/xml/ns/persistence">

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

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

          <jta-data-source>java:jboss/datasources/jbpm</jta-data-source>

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

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

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

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

          <properties>

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

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

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

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

            <property name="hibernate.transaction.manager_lookup_class" value="org.jbpm.integration.console.JBPMTransactionManager" />

          </properties>

        </persistence-unit>

      </persistence>

       

      and like this in 5.3:

       

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

      <persistence

          version="1.0"

          xsi:schemaLocation=

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

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

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

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

          xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns="http://java.sun.com/xml/ns/persistence">

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

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

          <jta-data-source>java:jboss/datasources/jbpm</jta-data-source>

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

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

          <class>org.drools.persistence.info.SessionInfo</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>

          <properties>

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

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

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

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

            <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />

          </properties>

        </persistence-unit>

      </persistence>

      JBPMorm.xml

      and finally my WEB-INF/classes/META-INF/JBPMorm.xml looks like this:

       

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

      <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"

                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"

                     version="2.0">

            <named-query name="ProcessInstancesWaitingForEvent">

                <query>

      select

          processInstanceInfo.processInstanceId

      from

          ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes

      where

          eventTypes = :type

                </query>

            </named-query>

      <sql-result-set-mapping name="ProcessInstancesWaitingForEvent.mapping">

        <column-result name="InstanceId" />

      </sql-result-set-mapping>

      <entity class="org.jbpm.persistence.processinstance.ProcessInstanceInfo">

          <attributes>

              <element-collection name="eventTypes">

                  <collection-table name="EventTypes">

                      <join-column name="InstanceId" />

                  </collection-table>

              </element-collection>

          </attributes>

      </entity>

      </entity-mappings>

      JBPMorm.xml error

      Here you will see that I followed someone's (I forget whose) note that suggests changing JBPMorm.xml following getting this error:

       

      Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: ProcessInstanceInfo, for columns: [org.hibernate.mapping.Column(eventTypes)]

        • 1. Re: JBPM Console Process List Error (No Persistence provider for EntityManager named org.jbpm.persistence.jpa)
          Newbie

          Update.  I upgraded to JBoss AS 7.1.1.  Not sure if this fixed this error or introduced more in front...but this particular error has gone away now.

          • 2. Re: JBPM Console Process List Error (No Persistence provider for EntityManager named org.jbpm.persistence.jpa)
            Adrian Apthorp Newbie

            I get the same error whenever I try to list tasks or processes in the console using JBPM 5.3. I have tried upgrading to JBOSS 7.1.1 as per Timothy's solution but still get the same result.

             

            My installation of JBPM 5.3 is a 'vanilla' install in to JBOSS AS.

             

            I see another post https://community.jboss.org/message/743095#743095 referencing the same error.
            • 3. Re: JBPM Console Process List Error (No Persistence provider for EntityManager named org.jbpm.persistence.jpa)
              Newbie

              Hi Adrian

               

              We are currently using 5.4.x snapshot version of console server due to a bug that wasn't fixed in the 5.3 human task service.  The trick with the Hibernate errors was to turn on trace level debug in standalone.xml by adding an entry to the logging module:

                          <logger category="org.jboss.as.jpa">

                              <level name="TRACE"/>

                          </logger>

              The log then usually contains enough information.  We found that the persistence provider was definitely being read, as it was being used to create the database (and there were logs to that effect) but not found on first DML use.

               

              Tim

              • 4. Re: JBPM Console Process List Error (No Persistence provider for EntityManager named org.jbpm.persistence.jpa)
                Adrian Apthorp Newbie

                Tim,

                 

                Thanks - however I'm still having problems. Are you using the JBPMorm.xml as in your post with 5.4.Snapshot? I tried this and am getting all sorts of errors starting with an error on version=2.0

                Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource META-INF/JBPMorm.xml

                    at org.hibernate.cfg.Configuration.addResource(Configuration.java:616) [hibernate-core-3.3.2.GA.jar:3.3.2.GA]

                    at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:957) [hibernate-annotations-3.4.0.GA.jar:3.3.2.GA]

                    at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:896) [hibernate-entitymanager-3.4.0.GA.jar:3.4.0.GA]

                    ... 48 more

                Caused by: org.hibernate.MappingException: invalid mapping

                    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:777) [hibernate-annotations-3.4.0.GA.jar:3.3.2.GA]

                    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:64) [hibernate-annotations-3.4.0.GA.jar:3.3.2.GA]

                    at org.hibernate.cfg.Configuration.addResource(Configuration.java:613) [hibernate-core-3.3.2.GA.jar:3.3.2.GA]

                    ... 50 more

                Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.

                    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)

                    at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:390)

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322)

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:281)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:446)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3271)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator.processOneAttribute(XMLSchemaValidator.java:2899)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2811)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2136)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:724)

                    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)

                    at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:733)

                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1754)

                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)

                    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)

                    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)

                    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)

                    at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196)

                    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555)

                    at org.dom4j.io.SAXReader.read(SAXReader.java:465) [dom4j-1.6.1.jar:1.6.1]

                    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:773) [hibernate-annotations-3.4.0.GA.jar:3.3.2.GA]

                    ... 52 more

                 

                When I fix this, I then get

                 

                 

                Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource META-INF/JBPMorm.xml

                    at org.hibernate.cfg.Configuration.addResource(Configuration.java:616) [hibernate-core-3.3.2.GA.jar:3.3.2.GA]

                    at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:957) [hibernate-annotations-3.4.0.GA.jar:3.3.2.GA]

                    at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:896) [hibernate-entitymanager-3.4.0.GA.jar:3.4.0.GA]

                    ... 48 more

                Caused by: org.hibernate.MappingException: invalid mapping

                    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:777) [hibernate-annotations-3.4.0.GA.jar:3.3.2.GA]

                    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:64) [hibernate-annotations-3.4.0.GA.jar:3.3.2.GA]

                    at org.hibernate.cfg.Configuration.addResource(Configuration.java:613) [hibernate-core-3.3.2.GA.jar:3.3.2.GA]

                    ... 50 more

                Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'element-collection'. One of '{"http://java.sun.com/xml/ns/persistence/orm":id, "http://java.sun.com/xml/ns/persistence/orm":embedded-id, "http://java.sun.com/xml/ns/persistence/orm":basic, "http://java.sun.com/xml/ns/persistence/orm":version, "http://java.sun.com/xml/ns/persistence/orm":many-to-one, "http://java.sun.com/xml/ns/persistence/orm":one-to-many, "http://java.sun.com/xml/ns/persistence/orm":one-to-one, "http://java.sun.com/xml/ns/persistence/orm":many-to-many, "http://java.sun.com/xml/ns/persistence/orm":embedded, "http://java.sun.com/xml/ns/persistence/orm":transient}' is expected.

                    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)

                    at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:390)

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322)

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:281)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:446)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3271)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1837)

                    at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:724)

                    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)

                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1653)

                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)

                    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)

                    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)

                    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)

                    at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196)

                    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555)

                    at org.dom4j.io.SAXReader.read(SAXReader.java:465) [dom4j-1.6.1.jar:1.6.1]

                    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:773) [hibernate-annotations-3.4.0.GA.jar:3.3.2.GA]

                    ... 52 more

                 

                Any thoughts?

                 

                Adrian