9 Replies Latest reply: Sep 19, 2012 8:29 AM by franco80 RSS

Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1

Brian O'Keefe Newbie

Hi all,

 

Hopefully this is an easy issue, but I am trying to deploy gwt-console-server in JBoss AS 7.1.1 and I am getting the following error in the log (below) due to JPA it seems.  I'm guessing that the duplicate import info on the first two lines is causing the failure, but I do not know why that is occurring.  Any guesses?

 

Thanks,

 

Brian

 

15:13:41,383 INFO  [org.hibernate.cfg.Configuration] (MSC service thread 1-2) HHH000071: Duplicate import: org.jbpm.persistence.processinstance.ProcessInstanceInfo -> org.jbpm.persistence.processinstance.ProcessInstanceInfo

15:13:41,399 INFO  [org.hibernate.cfg.Configuration] (MSC service thread 1-2) HHH000071: Duplicate import: org.jbpm.persistence.processinstance.ProcessInstanceInfo -> ProcessInstanceInfo

15:13:41,399 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.persistenceunit."jbpm-gwt-console-server.war#org.jbpm.persistence.jpa": org.jboss.msc.service.StartException in service jboss.persistenceunit."jbpm-gwt-console-server.war#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(Unknown Source) [rt.jar:1.6.0_30]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_30]

                at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_30]

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

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

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

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

                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: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

                at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3380)

                at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3369)

                at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3357)

                at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1334)

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

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

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

                ... 9 more

Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping org.jbpm.persistence.processinstance.ProcessInstanceInfo.eventTypes

                at org.hibernate.cfg.Configuration$MappingsImpl.addCollection(Configuration.java:2582)

                at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2139)

                at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2114)

                at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:405)

                at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:320)

                at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:171)

                at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3377)

                ... 15 more

  • 1. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    Maciej Swiderski Master

    Make sure you do not have duplicated ProcessInstanceInfo entity mapping. By this I mean you should have ProcessInstanceInfo.hbm.xml in classes/META-INF and persistence.xml should not contain ProcessInstanceInfo class listed in PU definition.

     

    HTH

  • 2. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    Brian O'Keefe Newbie

    EDIT:  Added configuration details as bottom of message

     

    Maciej, thank you for taking the time to respond.  Unfortunately, this did not solve the issue.  However, I am now wondering if perhaps the issue is a hibernate conflict.  I changed the JPA logging to "ALL" and found a few messages in the log that I think may indicate this (below) along with the configuration.  I appreciate any help I can get, as I am new to persistence and anything beyond the basics when it comes to JBoss and J2EE.  I think my next step is to remove the hibernate*.jar files from the WEB-INF/lib directory and add org.hibernate as a dependency to MANIFEST.MF.

     

    Thanks,

     

    Brian

     

     

    08:52:05,570 DEBUG [org.jboss.as.jpa] (MSC service thread 1-2) added (default provider) org.hibernate dependency to jbpm-gwt-console-server.war (since 1 PU(s) didn't specify jboss.as.jpa.providerModule)

    08:52:05,944 DEBUG [org.jboss.as.jpa] (MSC service thread 1-3) Deployment has its own persistence provider class org.hibernate.ejb.HibernatePersistence associated with classloaders [ModuleClassLoader for Module "deployment.jbpm-gwt-console-server.war:main" from Service Module Loader]

    08:52:06,380 DEBUG [org.jboss.as.jpa] (MSC service thread 1-3) loaded persistence provider adapter org.jboss.as.jpa.hibernate:4

    08:52:06,380 TRACE [org.jboss.as.jpa] (MSC service thread 1-3) returning global (module) Persistence Provider org.hibernate.ejb.HibernatePersistence

    08:52:06,380 TRACE [org.jboss.as.jpa] (MSC service thread 1-3) lookup provider checking provider version (4.0.1.Final)

    08:52:07,518 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (MSC service thread 1-3) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!

    08:52:07,845 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (MSC service thread 1-3) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!

     

    09:07:30,589 INFO [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for org.jbpm.persistence.jpa

    09:07:30,605 TRACE [org.jboss.as.jpa] (MSC service thread 1-1) PersistenceUnitMetadataImpl(version=1.0) [

    name: org.jbpm.persistence.jpa

    jtaDataSource: java:jboss/datasources/jbpmDS

    nonJtaDataSource: null

    transactionType: JTA

    provider: org.hibernate.ejb.HibernatePersistence

    classes[

    org.drools.persistence.info.SessionInfo org.drools.persistence.info.WorkItemInfo org.jbpm.process.audit.ProcessInstanceLog org.jbpm.process.audit.NodeInstanceLog org.jbpm.process.audit.VariableInstanceLog ]

    packages[

    ]

    mappingFiles[

    META-INF/ProcessInstanceInfo.hbm.xml

    ]

    jarFiles[

    ]

    validation-mode: AUTO

    shared-cache-mode: UNSPECIFIED

    properties[

    hibernate.max_fetch_depth: 3

    hibernate.transaction.manager_lookup_class: org.jbpm.integration.console.JBPMTransactionManager

    hibernate.dialect: org.hibernate.dialect.H2Dialect

    hibernate.show_sql: false

    hibernate.hbm2ddl.auto: update

    ]]

  • 3. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    Maciej Swiderski Master

    ok, so you trying with JPA2 then take a look at Marco's blog

     

    HTH

  • 4. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    Brian O'Keefe Newbie

    Thanks!  I had no idea this is JPA2, so thank you for pointing me in the right direction!

  • 5. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    Maciej Swiderski Master

    I meant that if you consider to make use of JBoss Modules (to declare dependencies org.hibernate that would mean you would like to use JPA2).

     

    Alternatively look at the standalone.xml file that comes with jbpm installer and apply the relevant changes to you 7.1.1 standalone.xml file - maybe even replacing that file with one from installer would work too, have not tried that myself yet.

     

    HTH

  • 6. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    Brian O'Keefe Newbie

    Thank you.  I did notice that the JPA module was commented out in the jbpm installer.  That is plan B if I cannot get it to work with JPA2 as I would like to get this to work on JBoss with other deployments that do use JPA.

  • 7. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    Ted Pan Newbie

    hi,

     

    you can remove the ProcessInstanceInfo.hbm.xml from META-INF. this file triggers the exception you got.

     

    Duplicate collection role mapping org.jbpm.persistence.processinstance.ProcessInstanceInfo.eventTypes

     

     

    in my environment, I use JBoss7.1.1 as well.  And I use JPA2 for the jbpm-gwt-console-server.war

    The following is what I did

    0. remove ProcessInstanceInfo.hbm.xml and persistence.xml from WEB-INF\classes\META-INF

    1. extract persistence-JPA2.xml and JBPMorm-JPA2.xml from WEB-INF\lib\jbpm-persistence-jpa-5.3.0.Final.jar to WEB-INF\classes\META-INF

    2. rename the persistence-JPA2.xml to persistence.xml

    3. add  <transient name="id" /> to inside the element <attributes> of <entity class="org.jbpm.persistence.processinstance.ProcessInstanceInfo"/> in JBPMorm-JPA2.xml

    4. add the following to persistence-JPA2.xmlJBPMorm-JPA2.xml

    <entity class="org.drools.persistence.info.SessionInfo" metadata-complete="false">

               <attributes>

                <id name="id">

                    <column name="id" />

                    <generated-value generator="sessionInfoIdSeq" strategy="SEQUENCE"></generated-value>

                    <sequence-generator name="sessionInfoIdSeq" sequence-name="SESSIONINFO_ID_SEQ" allocation-size="1"></sequence-generator>            </id>

              </attributes>

          </entity>

     

    (Thank Brian O\'Keefe for pointing out the mistakes. I updated the post for futher reference)

  • 8. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    Brian O'Keefe Newbie

    Thank you Ted!  I had to make some subtle changes in my enviroment, specifically:

    1.  In your step 4, I added this content to the JBPMorm-JPA2.xml file not persistence-JPA2.xml, as looking at the XSD, there was no entity element anywhere in the persistence element hierarchy.

    2.  In your step 3, the transient tag seems to go in the <attributes> element beneath <entity class="org.jbpm.persistence.processinstance.ProcessInstanceInfo"/>.  I am sure that is your shorthand, but I wanted to clarify in case any less experienced JPA people like me use this in the future.  It also seems to matter that this element occurs at the end of the sequence with the other transient elements. 

    3.  I had to change <jta-data-source> to "java:jboss/datasources/jbpmDS" from "jdbc/TestDS1", but I am sure that is something specific to my environment.

     

    I haven't tested the complete deployment yet, but I can now "enable" jbpm-gwt-console-server.war, so I'll consider this question answered.

     

     

    Thank you again!

  • 9. Re: Persistence issue running jBPM 5.3 gwt-console-server on JBoss AS 7.1.1
    franco80 Newbie

    For sqlserver2005 dialect orm what I must changing in below ?

     

    <entity class="org.drools.persistence.info.SessionInfo" metadata-complete="false">

               <attributes>

                <id name="id">

                    <column name="id" />

                    <generated-value generator="sessionInfoIdSeq" strategy="SEQUENCE"></generated-value>

                    <sequence-generator name="sessionInfoIdSeq" sequence-name="SESSIONINFO_ID_SEQ" allocation-size="1"></sequence-generator>            </id>

              </attributes>

          </entity>

     

     

    when I changed as below:

     

    <entity class="org.drools.persistence.info.SessionInfo" metadata-complete="false">

               <attributes>

                <id name="id">

                    <column name="id" />

                    <generated-value strategy="AUTO"></generated-value>

                </id>

              </attributes>

            </entity>

     

    I recived error in time log in to jbpm console:

     

    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column 'id', table 'jbpmProcess.dbo.SessionInfo'; column does not allow nulls. INSERT fails.

     

    it's worked now   All sequence configuration was removed from SessionInfo entity.

     

    <entity class="org.drools.persistence.info.SessionInfo" metadata-complete="false">

               <attributes>

                <id name="id">

                    <column name="id" />

                    <generated-value strategy="IDENTITY"></generated-value>

                </id>

              </attributes>

            </entity>