Issue in deploying JBPM 5.4 console server war on Websphere application server with JPA2 feature pack to use oracle database

StackOverflow https://stackoverflow.com/questions/19708831

Question

Facing issue in deploying JBPM 5.4 console server war to use oracle database. Please find below the stacktrace.

  [10/31/13 19:17:01:295 IST] 00000009 JPAPUnitInfo  E   CWWJP0015E: An error occurred in the org.hibernate.ejb.HibernatePersistence persistence provider when it attempted to create the container entity manager factory for the org.jbpm.persistence.jpa persistence unit. The following error occurred: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory
    [10/31/13 19:17:01:296 IST] 00000009 JPAPUnitInfo  E   CWWJP0009E: The server cannot create an EntityManagerFactory factory for the org.jbpm.persistence.jpa persistent unit from the org.hibernate.ejb.HibernatePersistence provider in file:/C:/Data/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/USMUMRANANDIGA1Node01Cell/jbpm-gwt-console-server-5_4_0_Final-EE6_A_war.ear/jbpm-gwt-console-server-5.4.0.Final-EE6_A.war/WEB-INF/classes/ module.
    [10/31/13 19:17:01:295 IST] 00000009 FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\Data\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\ffdc\server1_33d433d4_13.10.31_19.17.01.2236946324497770174513.txt com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory 759
    [10/31/13 19:17:02:118 IST] 00000009 SystemOut     O 1    31/10 19:17:02,110[server.startup : 1] ERROR tool.hbm2ddl.SchemaUpdate.execute  - could not get database metadata
    java.sql.SQLException: Unsupported use of GenericConnection.  A GenericConnection is provided during application start when creating an EntityManagerFactory for a persistence unit which has configured one of its datasource to be in the component naming context; java:comp/env. During application start, the component naming context will not exist, and the correct datasource cannot be determined. When the persistence unit is used, the proper datasource and connection will be obtained and used.
        at com.ibm.ws.jpa.management.GenericConnection.unsupportedUseSQLException(GenericConnection.java:584)
        at com.ibm.ws.jpa.management.GenericConnection.createStatement(GenericConnection.java:151)
        at org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMetadata.java:150)
        at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:69)
        at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:62)
        at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:170)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:356)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
        at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
        at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1602)
        at com.ibm.ws.jpa.management.JPAPUnitInfo.createEntityManagerFactory(JPAPUnitInfo.java:1352)
        at com.ibm.ws.jpa.management.JPAPxmlInfo.extractPersistenceUnits(JPAPxmlInfo.java:243)
        at com.ibm.ws.jpa.management.JPAScopeInfo.processPersistenceUnit(JPAScopeInfo.java:117)
        at com.ibm.ws.jpa.management.JPAApplInfo.processModulePUs(JPAApplInfo.java:169)
        at com.ibm.ws.jpa.management.JPAComponentImpl.startingDeployedModule(JPAComponentImpl.java:878)
        at com.ibm.ws.jpa.management.JPAComponentImpl.stateChanged(JPAComponentImpl.java:722)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.stateChanged(ApplicationMgrImpl.java:1080)
        at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectEvent(DeployedApplicationImpl.java:1302)
        at com.ibm.ws.runtime.component.DeployedModuleImpl.setState(DeployedModuleImpl.java:222)
        at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:608)
        at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:944)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:741)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl$3.run(ApplicationMgrImpl.java:2056)
        at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5395)
        at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5483)
        at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2061)
        at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
        at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
        at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332)
        at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$300(CompositionUnitMgrImpl.java:117)
        at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:899)
        at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:496)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1656)
    [10/31/13 19:17:02:119 IST] 00000009 SystemOut     O 10   31/10 19:17:02,119[server.startup : 1] ERROR tool.hbm2ddl.SchemaUpdate.execute  - could not complete schema update
    java.sql.SQLException: Unsupported use of GenericConnection.  A GenericConnection is provided during application start when creating an EntityManagerFactory for a persistence unit which has configured one of its datasource to be in the component naming context; java:comp/env. During application start, the component naming context will not exist, and the correct datasource cannot be determined. When the persistence unit is used, the proper datasource and connection will be obtained and used.
        at com.ibm.ws.jpa.management.GenericConnection.unsupportedUseSQLException(GenericConnection.java:584)
        at com.ibm.ws.jpa.management.GenericConnection.createStatement(GenericConnection.java:151)
        at org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMetadata.java:150)
        at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:69)
        at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:62)
        at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:170)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:356)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
        at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
        at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1602)
        at com.ibm.ws.jpa.management.JPAPUnitInfo.createEntityManagerFactory(JPAPUnitInfo.java:1352)
        at com.ibm.ws.jpa.management.JPAPxmlInfo.extractPersistenceUnits(JPAPxmlInfo.java:243)
        at com.ibm.ws.jpa.management.JPAScopeInfo.processPersistenceUnit(JPAScopeInfo.java:117)
        at com.ibm.ws.jpa.management.JPAApplInfo.processModulePUs(JPAApplInfo.java:169)
        at com.ibm.ws.jpa.management.JPAComponentImpl.startingDeployedModule(JPAComponentImpl.java:878)
        at com.ibm.ws.jpa.management.JPAComponentImpl.stateChanged(JPAComponentImpl.java:722)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.stateChanged(ApplicationMgrImpl.java:1080)
        at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectEvent(DeployedApplicationImpl.java:1302)
        at com.ibm.ws.runtime.component.DeployedModuleImpl.setState(DeployedModuleImpl.java:222)
        at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:608)
        at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:944)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:741)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl$3.run(ApplicationMgrImpl.java:2056)
        at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5395)
        at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5483)
        at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2061)
        at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
        at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
        at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332)
        at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$300(CompositionUnitMgrImpl.java:117)
        at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:899)
        at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:496)
        at com.ibm.ws.util.ThreadPool$Worker.r

un(ThreadPool.java:1656)

Please find below the persistence.xml entry :

<?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>java:comp/env/jdbc/jbpmDS</jta-data-source>

            <class>org.drools.persistence.info.SessionInfo</class>
            <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</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.max_fetch_depth" value="3" />

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



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




            </properties>

        </persistence-unit>
    </persistence>

jbpmDS is configured on WAS 7. Friends any ideas about the root cause?

I have configured my persistence.xml in the following way to resolve the issue :

<?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 transaction-type="RESOURCE_LOCAL"
            name="org.jbpm.persistence.jpa">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>

            <mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file>
            <mapping-file>META-INF/ProcessInstanceInfoMapping-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>
            <class>org.jbpm.process.audit.ProcessInstanceLog</class>
            <class>org.jbpm.process.audit.NodeInstanceLog</class>
            <class>org.jbpm.process.audit.VariableInstanceLog</class>
            <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.OracleDialect" />
                <property name="hibernate.generateDdl" value="true" />
                <property name="hibernate.showSql" value="true" />
                <property name="hibernate.max_fetch_depth" value="3" />
                <property name="hibernate.hbm2ddl.auto" value="update" />
                <property name="hibernate.archive.autodetection" value="class" />
                <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
                <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe" />
                <property name="hibernate.connection.username" value="arunabh" />
                <property name="hibernate.connection.password" value="arunabh" />
            </properties>
        </persistence-unit>
    </persistence>
Was it helpful?

Solution

<jta-data-source>java:comp/...</jta-data-source> does not work well with container-managed Hibernate JPA. WebSphere Application Server needs to call createContainerEntityManagerFactory prior to doing nearly everything else in the application because that call might register a ClassFileTransformer that needs to modify entity bytecodes.

Your options are:

  1. Remove the use of <jta-data-source>java:comp/...</jta-data-source> and use a JNDI name from the server namespace (e.g., <jta-data-source>jdbc/myds</jta-data-source>).

  2. Disable container-managed JPA for the application as described in APAR PM26361. (This APAR describes performance issues caused by the call to createContainerEntityManagerFactory during application start, but the property can also be used to avoid this problem.) Of course, disabling container-managed JPA means you can no longer use @PersistenceUnit/@PersistenceContext annotations or <persistence-unit-ref>/<persistence-context-ref>.

OTHER TIPS

It seems related with names of the datasources as this post said.. try that first and see if you get the second error: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014210826

I agree with @bkail on this.
I was facing similar problem while running on WAS 7. Resolved it following the 1st option in the answer. 2nd option is not recommended since client uses the same server to host multiple applications.
In addition to that I also removed the jar file jbpm-test-5.4.0.Final.jar from EAR -> Deployment Assembly as well as WEB-INF/lib in the WAR Project. Otherwise it does not work with the first option only since Websphere detects a data source inside the jar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top