5 Replies Latest reply on Jul 16, 2012 12:20 AM by Jett Gamboa

    JBPM 5.3.0.Final, JBoss 7.1.1.Final and Hibernate 4

    Brian Wallis Master

      Simple question, can I get JBpm 5.3.0 working running in JBoss 7.1.1 with its version of Hibernate (4.0.1 I think) or do I have to include a version of hibernate with my app.

       

      I am getting an error on startup that seems to be a JPA 1.0/2.0 issue:

       

       

      {noformat}

      14:41:48,263 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 62) MSC00001: Failed to start service jboss.persistenceunit."harvey-ear.ear/workflow.jar#org.jbpm.persistence.jpa": org.jboss.msc.service.StartException in service jboss.persistenceunit."harvey-ear.ear/workflow.jar#org.jbpm.persistence.jpa": javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:91)

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

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

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

              at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)

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

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

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$500(PersistenceUnitServiceImpl.java:56)

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:88)

              ... 4 more

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

              at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:305)

              at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:289)

              at org.hibernate.mapping.Property.isValid(Property.java:238)

              at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468)

              at org.hibernate.mapping.RootClass.validate(RootClass.java:270)

              at org.hibernate.cfg.Configuration.validate(Configuration.java:1294)

              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1736)

              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)

              ... 9 more

      {noformat}

        • 1. Re: JBPM 5.3.0.Final, JBoss 7.1.1.Final and Hibernate 4
          Maciej Swiderski Master

          Have a look here at Marco's blog about JPA2 for drools and jbpm.

           

          HTH

          • 2. Re: JBPM 5.3.0.Final, JBoss 7.1.1.Final and Hibernate 4
            Brian Wallis Master

            Thanks, A read of Marco's blog and a bit of sorting out of the dependencies got it working

             

            (So, in short, yes JBPM 5.3 does work in jboss 7.1.2 (snapshot) with Hibernate 4)

            • 3. Re: JBPM 5.3.0.Final, JBoss 7.1.1.Final and Hibernate 4
              Jett Gamboa Newbie

              Hi Brian, Would you mind sharing your pom and persistence.xml? I am in the same situation. I attempted to follow Marco's blog but I am still getting a bunch of errors.

               

              Thanks

              • 4. Re: JBPM 5.3.0.Final, JBoss 7.1.1.Final and Hibernate 4
                Brian Wallis Master

                hi Jett, sorry for the late reply.

                 

                My persistence.xml is:

                 

                {code}

                <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="org.jbpm.persistence.jpa" transaction-type="JTA">

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

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

                        <mapping-file>META-INF/JBPMorm-JPA2.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.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

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

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

                            <property name="hibernate.jdbc.use_streams_for_binary" value="true" />

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

                        </properties>

                    </persistence-unit>

                 

                 

                </persistence>

                {code}

                 

                the only change I made in the end was the addition of the mapping file line. The pom file (slightly abridged) is

                 

                 

                {code}

                <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

                    <modelVersion>4.0.0</modelVersion>

                    <artifactId>workflow</artifactId>

                    <packaging>ejb</packaging>

                    <name>workflow</name>

                    <parent>

                        <groupId>au.com.infomedix</groupId>

                        <artifactId>harvey-all</artifactId>

                        <version>1.0-SNAPSHOT</version>

                        <relativePath>../../harvey-all/pom.xml</relativePath>

                    </parent>

                 

                    <dependencies>

                        <!-- Import the Common Annotations API (JSR-250), we use provided scope as the API is included in JBoss AS 7.1 -->

                        <dependency>

                            <groupId>org.jboss.spec.javax.annotation</groupId>

                            <artifactId>jboss-annotations-api_1.1_spec</artifactId>

                            <scope>provided</scope>

                        </dependency>

                        <!-- Import the EJB 3.1 API, we use provided scope as the API is included in JBoss AS 7.1 -->

                        <dependency>

                            <groupId>org.jboss.spec.javax.ejb</groupId>

                            <artifactId>jboss-ejb-api_3.1_spec</artifactId>

                            <scope>provided</scope>

                        </dependency>

                        <!-- Import the JMS 1.1 API, we use provide scope as the API is included in JBoss AS 7.1 -->

                        <dependency>

                            <groupId>org.jboss.spec.javax.jms</groupId>

                            <artifactId>jboss-jms-api_1.1_spec</artifactId>

                            <scope>provided</scope>

                        </dependency>

                        <!-- Import the JPA Persistence API -->

                        <dependency>

                            <groupId>org.hibernate.javax.persistence</groupId>

                            <artifactId>hibernate-jpa-2.0-api</artifactId>

                            <scope>provided</scope>

                        </dependency>

                        <dependency>

                            <groupId>xalan</groupId>

                            <artifactId>xalan</artifactId>

                        </dependency>

                        <!-- PDF Building -->

                        <dependency>

                            <groupId>org.xhtmlrenderer</groupId>

                            <artifactId>core-renderer</artifactId>

                            <scope>compile</scope>

                        </dependency>

                        <dependency>

                            <groupId>com.itextpdf</groupId>

                            <artifactId>itextpdf</artifactId>

                            <scope>compile</scope>

                        </dependency>

                        <dependency>

                            <groupId>dom4j</groupId>

                            <artifactId>dom4j</artifactId>

                            <scope>provided</scope>

                        </dependency>

                        <!-- jBPM dependencies -->

                        <dependency>

                            <groupId>org.jbpm</groupId>

                            <artifactId>jbpm-bam</artifactId>

                            <scope>compile</scope>

                        </dependency>

                        <dependency>

                            <groupId>org.jbpm</groupId>

                            <artifactId>jbpm-bpmn2</artifactId>

                            <scope>compile</scope>

                        </dependency>

                        <dependency>

                            <groupId>org.drools</groupId>

                            <artifactId>drools-decisiontables</artifactId>

                            <scope>compile</scope>

                        </dependency>

                        <dependency>

                            <groupId>commons-collections</groupId>

                            <artifactId>commons-collections</artifactId>

                            <scope>compile</scope>

                        </dependency>

                        <dependency>

                            <groupId>org.jbpm</groupId>

                            <artifactId>jbpm-persistence-jpa</artifactId>

                            <scope>compile</scope>

                        </dependency>

                        <dependency>

                            <groupId>org.codehaus.btm</groupId>

                            <artifactId>btm</artifactId>

                            <scope>compile</scope>

                        </dependency>

                    </dependencies>

                 

                    <build>

                        <plugins>

                            <plugin>

                                <groupId>org.apache.maven.plugins</groupId>

                                <artifactId>maven-compiler-plugin</artifactId>

                            </plugin>

                            <plugin>

                                <groupId>org.apache.maven.plugins</groupId>

                                <artifactId>maven-ejb-plugin</artifactId>

                            </plugin>

                            <plugin>

                                <groupId>org.apache.maven.plugins</groupId>

                                <artifactId>maven-dependency-plugin</artifactId>

                            </plugin>

                        </plugins>

                    </build>

                </project>

                {code}

                 

                Hope this is of some help.

                 

                I seem to have it all working fine in a 7.2.0 Alpha version of the appserver when built against the 7.1.1.Final version of the jboss packages. The pom (above) doesn't have the version numbers as these come from the parent pom and mostly from the jboss org.jboss.as:jboss-as-parent:7.1.1.Final maven package.

                • 5. Re: JBPM 5.3.0.Final, JBoss 7.1.1.Final and Hibernate 4
                  Jett Gamboa Newbie

                  Thanks Brian. I appreciate the time you spent posting this online for everyone to benefit from. I'll check it out but since it worked for you, I am sure it will for me.

                   

                  Thanks again