JBoss Community

Re: Persistence Issues

created by Yogesh Garg in jBPM - View the full discussion

I have no issues in installing any component. The problem seems to be revovling around persistence.xml. I think jBPM 5.x uses JPA 2.0 and Hibernate 4.x. I went through http://mriet.wordpress.com/2012/04/03/jpa-2-with-drools-and-jbpm/ and made requiste changes. I have made following changes:

 

  1. Commented  <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>. Now the question is do I need to remove this file from the META-INF folder of project as well.
  2. changed 1.0 to 2.0 and _1_.0 to _2_.0 to at required places.
  3. changed JBPMorm.xml to JBPMorm-JPA2.xml.. I have added this file to the META-INF folder of the project as well, let me know if this file needs to be modified as well as I have seen in this thread https://community.jboss.org/message/739318#739318
  4. Changed the transaction manager as well as mentioned.

 

Although I am rid of these errors, but new ones have cropped up. Have a look at my persistence.xml and error log

 

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

<persistence version="2.0"

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

             xmlns:orm="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 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">

            

 

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

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

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

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

        <!-- This line MUST be commented and NOT active when using JPA 2:

        <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>

        -->

       

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

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

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

       

        <properties>

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

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

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

            <!-- The following line is what's used in Hibernate 4 instead of a TransactionManagerLookup class -->

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

           

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

        

            <property name="hibernate.connection.driver_class" value="org.h2.Driver" />

            <property name="hibernate.connection.url" value="jdbc:h2:mem:mydb" />

            <property name="hibernate.connection.username" value="sa" />

            <property name="hibernate.connection.password" value="sasa" />

        </properties>       

    </persistence-unit>

   

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

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

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

        <class>org.jbpm.task.Attachment</class>

        <class>org.jbpm.task.Content</class>

        <class>org.jbpm.task.BooleanExpression</class>

        <class>org.jbpm.task.Comment</class>

        <class>org.jbpm.task.Deadline</class>

        <class>org.jbpm.task.Comment</class>

        <class>org.jbpm.task.Deadline</class>

        <class>org.jbpm.task.Delegation</class>

        <class>org.jbpm.task.Escalation</class>

        <class>org.jbpm.task.Group</class>

        <class>org.jbpm.task.I18NText</class>

        <class>org.jbpm.task.Notification</class>

        <class>org.jbpm.task.EmailNotification</class>

        <class>org.jbpm.task.EmailNotificationHeader</class>

        <class>org.jbpm.task.PeopleAssignments</class>

        <class>org.jbpm.task.Reassignment</class>

        <class>org.jbpm.task.Status</class>

        <class>org.jbpm.task.Task</class>

        <class>org.jbpm.task.TaskData</class>

        <class>org.jbpm.task.SubTasksStrategy</class>

        <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>

        <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>

        <class>org.jbpm.task.User</class>

        <properties>

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

            <property name="hibernate.connection.driver_class" value="org.h2.jdbcx.JdbcDataSource"/>

            <property name="hibernate.connection.url" value="jdbc:h2:tcp://localhost/runtime/task" />

            <property name="hibernate.connection.username" value="sa"/>

            <property name="hibernate.connection.password" value=""/>

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

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

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

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

        </properties>

    </persistence-unit>

   

</persistence>

 

 

Error Log

 

..Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to configure EntityManagerFactory

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

    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)

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

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

    at com.sample.ProcessMain.createKnowledgeSession(ProcessMain.java:154)

    at com.sample.ProcessMain.main(ProcessMain.java:51)

Caused by: org.hibernate.MappingException: Error while parsing file: META-INF/JBPMorm-JPA2.xml

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

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

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

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

    ... 5 more

Caused by: org.hibernate.MappingException: invalid mapping

    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:777)

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

    ... 8 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 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)

    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)

    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)

    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)

    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:417)

    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3182)

    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processOneAttribute(XMLSchemaValidator.java:2802)

    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2714)

    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2066)

    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)

    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)

    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)

    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3104)

    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)

    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)

    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)

    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)

    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)

    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)

    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)

    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)

    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)

    at org.dom4j.io.SAXReader.read(SAXReader.java:465)

    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:773)

    ... 9 more

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(5) 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'.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(18) cvc-complex-type.2.4.a: Invalid content was found starting with element 'mapping-file'. One of '{"http://java.sun.com/xml/ns/persistence/orm":named-query, "http://java.sun.com/xml/ns/persistence/orm":named-native-query, "http://java.sun.com/xml/ns/persistence/orm":sql-result-set-mapping, "http://java.sun.com/xml/ns/persistence/orm":mapped-superclass, "http://java.sun.com/xml/ns/persistence/orm":entity, "http://java.sun.com/xml/ns/persistence/orm":embeddable}' is expected.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(24) cvc-complex-type.2.4.a: Invalid content was found starting with element 'id'. One of '{"http://java.sun.com/xml/ns/persistence/orm":transient}' is expected.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(28) cvc-complex-type.3.2.2: Attribute 'access' is not allowed to appear in element 'basic'.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(29) cvc-complex-type.3.2.2: Attribute 'access' is not allowed to appear in element 'basic'.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(32) cvc-complex-type.3.2.2: Attribute 'access' is not allowed to appear in element 'basic'.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(35) cvc-complex-type.3.2.2: Attribute 'access' is not allowed to appear in element 'basic'.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(38) cvc-complex-type.3.2.2: Attribute 'access' is not allowed to appear in element 'basic'.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(39) cvc-complex-type.3.2.2: Attribute 'access' is not allowed to appear in element 'basic'.

0    29/10 14:22:12,885[main] ERROR hibernate.util.XMLHelper.error  - Error parsing XML: XML InputStream(42) cvc-complex-type.3.2.2: Attribute 'access' is not allowed to appear in element 'version'.

 

Regards.

Reply to this message by going to Community

Start a new discussion in jBPM at Community