4 Replies Latest reply on Jan 4, 2013 10:33 AM by rafaelsoledadem

    persistence unit error in jboss

    rafaelsoledadem

      Hi,

       

      I'm having some trouble while running my jBPM project on jboss 5. Just before the server starts, I get an error:

       

      DEPLOYMENTS IN ERROR:

           Deployment "persistence.unit:unitName=myProj.ear/#BPM-DB" is in error due to the following reason(s): java.lang.ClassNotFoundException: org.jbpm.persistence.ProcessInstanceInfo from BaseClassLoader{jboss_project_path/jboss-service.xml}

       

      I really can't understand why this happens, since I have the orm.xml, persistence.xml and ProcessInstanceInfo.hbm.xml. Can anyone help me with this? Google has not been my friend on this subject.

       

      ---------

       

      ProcessInstanceInfo.hbm.xml

       

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

      <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

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

      <hibernate-mapping package="org.jbpm.persistence.processinstance">

       

       

          <!-- access="field" for fields that have no setter methods -->

          <class name="ProcessInstanceInfo" table="ProcessInstanceInfo">

         

              <id name="processInstanceId" type="long" column="InstanceId">

                  <generator class="native" />

              </id>

             

              <version name="version" type="integer" unsaved-value="null" access="field">

                <column name="OPTLOCK" not-null="false" />

              </version>

             

              <property name="processId" access="field" />

              <property name="startDate" type="timestamp" access="field" />

              <property name="lastReadDate" type="timestamp"  access="field" />

              <property name="lastModificationDate" type="timestamp" access="field" />

              <property name="state" type="integer" not-null="true" access="field" />

            

             <property name="processInstanceByteArray" type="org.hibernate.type.PrimitiveByteArrayBlobType"

                  column="processInstanceByteArray" access="field" length="2147483647" />

       

       

              <set name="eventTypes" table="EventTypes" access="field" >

                  <key column="InstanceId"/>

                  <element column="element" type="string"/>

              </set>

         

              <!-- NOT mapping [processInstance] field because field is transient -->   

              <!-- NOT mapping [env] field because field is transient -->   

             

          </class>

       

       

      </hibernate-mapping>

       

      -------

       

      persistence.xml

       

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

      <persistence version="2.0"

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

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

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

                                       http://java.sun.com/xml/ns/persistence/orm_2_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="BPM-DB" transaction-type="JTA">

       

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

       

                          <jta-data-source>java:/DefaultDS</jta-data-source>

       

       

                          <mapping-file>META-INF/JBPMorm-JPA2.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.default_schema" value="bpmdata" />

       

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

                                    <property name="hibernate.connection.autocommit" value="false" />

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

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

                                    <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />

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

                                    <property name="hibernate.transaction.flush_before_completion" value="true" />

       

                          </properties>

                </persistence-unit>

       

       

      </persistence>

       

      -------------------

       

      orm.xml

       

      <?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="1.0">

                <named-query name="ProcessInstancesWaitingForEvent">

                          <query>

                                    select

                                    processInstanceInfo.processInstanceId

                                    from

                                    ProcessInstanceInfo processInstanceInfo

                                    where

                                    :type in elements(processInstanceInfo.eventTypes)

                </query>

                </named-query>

       

       

      </entity-mappings>


        • 1. Re: persistence unit error in jboss
          swiderski.maciej

          looks like you have a mix of JPA 1 and 2 and I don't think JBoss 5 supports JPA 2. You have persistence.xml configured with jpa2 but orm with JPA1, I would suggest to aligned both to be at JPA1 version level and try again.

           

          HTH

          • 2. Re: persistence unit error in jboss
            rafaelsoledadem

            Hey, thank you for replying.

             

            I did as you sugested, but it's the same. The problem is those persistence classes aren't being found for some reason...even when I map the log ones, I get the same error. Got any idea what I'm missing here?

            • 3. Re: persistence unit error in jboss
              swiderski.maciej

              how do you deploy your application? is it war or ear? or maybe you use eclipse wtp to deploy from workspace?

               

              basic question are you sure that all jbpm classes (especially drools-persistence-jpa.jar and jbpm-persistence-jpa.jar) are on the class path? What looks odd is this: jboss_project_path/jboss-service.xml have not seen this before...

               

              HTH

              • 4. Re: persistence unit error in jboss
                rafaelsoledadem

                I have solved my issue. As you said, the jpa jars were not all on the class path. Very basic problem, and I have no idea why the error mentioned jboss-service.xml...

                 

                So, the solution:

                 

                Download jbpm-persistence-jpa-x.x.x.Final.jar and drools-persistence-jpa-x.x.x.Final.jar and add them to your class path! In my case, I had to add them to my .ear manually, and later on will have to add the new stuff on Maven.

                 

                Thank you for the help, Maciej

                1 of 1 people found this helpful