10 Replies Latest reply on Mar 20, 2012 5:25 PM by ramkijbpm

    Errors in named queries: TasksAssignedAsPotential Owner

    sharyak Newbie

      I finally managed to deploy jBPM on WebLogic 10.3.5 using hibernate as JPA provider. Database is Oracle. However, if I have orm.xm reference in the persistency.xml and have it in the same META-INF folder, I am getting Errors in named queries: TasksAssignedAsPotential Owner and all other queries in this file when I am trying to deploy application.

       

      weblogic-application xml has following lines to use antlr-2.7.7 and antlr-3.3 that comes with jBPM instead of the ones that come with weblogic:

      <wls:prefer-application-packages>

      <wls:package-name>antlr.*</wls:package-name>

      <wls:package-name>org.hibernate.*</wls:package-name>

      </wls:prefer-application-packages>

       

       

      <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.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.dialect" value="org.hibernate.dialect.Oracle10gDialect" />

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

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

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

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

          </properties> 

                      

           

        </persistence-unit>

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

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

        <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="current_session_context_class" value="thread"/>

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

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

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

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

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

          </properties> 

       

       

        </persistence-unit>

       

      </persistence>

       

      Any ideas ?

        • 1. Re: Errors in named queries: TasksAssignedAsPotential Owner
          Maciej Swiderski Master

          First of all, could you post what kind of error do you encounter?

           

          Another question - what orm file and what persistence.xml file are we talking about? Is it persistence configuration JBPM or Task Service?

           

          Cheers

          • 2. Re: Errors in named queries: TasksAssignedAsPotential Owner
            sharyak Newbie

            This is the error that I am getting:

            weblogic.application.ModuleException: Exception preparing module: EJBModule(integration.jar)

             

                at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:469)

                at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)

                at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)

                at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)

                Truncated. see log file for complete stacktrace

            Caused By: org.hibernate.HibernateException: Errors in named queries: TasksAssignedAsPotentialOwner, UnescalatedDeadlines, TasksAssignedAsTaskStakeholder, TasksAssignedAsRecipient, TasksAssignedAsPotentialOwnerByGroup, TasksAssignedAsExcludedOwner, TasksAssignedAsBusinessAdministrator, SubTasksAssignedAsPotentialOwner, TaskByWorkItemId, TasksOwned, TasksAssignedAsPotentialOwnerWithGroups, GetSubTasksByParentTaskId, TasksAssignedAsTaskInitiator

                at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:397)

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

                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)

             

            The problem is with the TaskServer. The orm.xml is the one that is provided in the jbpm-human-task-5.1.0-Final.

             

            Thank you a lot for trying to help me out !

            • 3. Re: Errors in named queries: TasksAssignedAsPotential Owner
              Demian Calcaprina Master

              There should be some more log about the specific errors.

               

              If you see hibernate's session factory impl:

               

              for {

                   ...

                   log.error( "Error in named query: " + queryName, e );

              }

              throw new HibernateException( failingQueries.toString() );

               

              Demian

              • 4. Re: Errors in named queries: TasksAssignedAsPotential Owner
                sharyak Newbie

                You are correct, there is more in the log.

                org.hibernate.HibernateException: Errors in named queries: TasksAssignedAsPotentialOwner, UnescalatedDeadlines, TasksAssignedAsTaskStakeholder, TasksAssignedAsRecipient, TasksAssignedAsPotentialOwnerByGroup, TasksAssignedAsExcludedOwner, TasksAssignedAsBusinessAdministrator, SubTasksAssignedAsPotentialOwner, TaskByWorkItemId, TasksOwned, TasksAssignedAsPotentialOwnerWithGroups, GetSubTasksByParentTaskId, TasksAssignedAsTaskInitiator

                    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:397)

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

                    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 weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:393)

                    at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:386)

                    at weblogic.deployment.BasePersistenceUnitInfoImpl.<init>(BasePersistenceUnitInfoImpl.java:158)

                    at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:46)

                    at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:349)

                    at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:263)

                    at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:69)

                    at weblogic.ejb.container.deployer.EJBModule.setupPersistenceUnitRegistry(EJBModule.java:223)

                    at weblogic.ejb.container.deployer.EJBModule$1.execute(EJBModule.java:324)

                    at weblogic.deployment.PersistenceUnitRegistryInitializer.setupPersistenceUnitRegistries(PersistenceUnitRegistryInitializer.java:62)

                    at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:393)

                    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)

                    at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)

                    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)

                    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)

                    at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:613)

                    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:184)

                    at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)

                    at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)

                    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)

                    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)

                    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)

                    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)

                    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)

                    at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)

                    at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)

                    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)

                    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)

                    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)

                    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)

                    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)

                    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)

                    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

                >

                 

                As soon as I remove orm.xml, the error goes away

                • 5. Re: Errors in named queries: TasksAssignedAsPotential Owner
                  Mauricio Salatino Master

                  It's the first time that I saw that error in namedQueries. Are you using the hibernate version provided by Weblogic or the one provided by jBPM5?

                  Cheers

                  • 6. Re: Errors in named queries: TasksAssignedAsPotential Owner
                    Sasi R Newbie

                    I got this error in websphere and solved this by adding fully qualifies class names in orm.xml. Certainly seems to be an issue which needs to be taken care. Please try it and confirm if it solves your issue as well

                    Cheers

                    • 7. Re: Errors in named queries: TasksAssignedAsPotential Owner
                      Mauricio Salatino Master

                      I don't have a websphere here.. but it will be good if that solves the problem find out exactly why do you need to use FQN there.

                      Cheers

                      • 8. Re: Errors in named queries: TasksAssignedAsPotential Owner
                        sharyak Newbie

                        This is correct.

                        I also had to remove persistency.xml from the jbm-human-task.jar that I had in my lib folder. Once I made these 2 changes, I was able to deploy. Thank you !

                        • 9. Re: Errors in named queries: TasksAssignedAsPotential Owner
                          ramkijbpm Newbie

                          this is completely wrong. It cannot work if you remove the TaskOrm.xml having all those namedQueries. if you remove you will get the following exception,

                          Caused By:

                          javax.persistence.PersistenceException

                          : [PersistenceUnit: org.jbpm.persistence.jpa] Unable to find XML mapping file in classpath: META-INF/Taskorm.xml

                           

                           

                           

                           

                          I get this very same exception about namedQueries in Weblogic. Is there any good solution to this below problem? It really is very painful!!! Is JBPM compatible to weblogic server?

                           

                           

                          Caused By:

                          org.hibernate.HibernateException

                          : Errors in named queries: TasksAssignedAsPotentialOwner, UnescalatedDeadlines, TasksAssignedAsTaskStakeholder, TasksAssignedAsRecipient, TasksAssignedAsPotentialOwnerByGroup, TasksAssignedAsExcludedOwner, TasksAssignedAsBusinessAdministrator, SubTasksAssignedAsPotentialOwner, ProcessInstancesWaitingForEvent, TaskByWorkItemId, TasksOwned, TasksAssignedAsPotentialOwnerWithGroups, GetSubTasksByParentTaskId, TasksAssignedAsTaskInitiator

                           

                           

                           

                           

                          Find my persistence.xml

                          <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                          <persistence version="1.0"
                          xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                                                           http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
                                                           http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_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="com.taskServer.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.Oracle10gDialect" />
                             <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
                             <property name="hibernate.connection.url" value="jdbc:oracle:thin:@//xxxx:11102/xxxxx2" />
                             <property name="hibernate.connection.username" value="xxxx" />
                             <property name="hibernate.connection.password" value="xxxxxxx" />
                             <property name="hibernate.connection.autocommit" value="false" />
                             <property name="hibernate.max_fetch_depth" value="3" />
                             <property name="hibernate.hbm2ddl.auto" value="validate" />
                             <property name="hibernate.show_sql" value="true" />
                             <property name="hibernate.query.startup_check" value="false" />
                            </properties>
                          </persistence-unit>
                          <persistence-unit name="jbpm.persistence.jpa" transaction-type="JTA">
                            <provider>org.hibernate.ejb.HibernatePersistence</provider>
                            <jta-data-source>JTADataSource1</jta-data-source>
                            <mapping-file>META-INF/JBPMorm.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> 
                            <properties>
                             <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
                             <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>              
                             <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
                             <property name="hibernate.connection.datasource" value="JTADataSource1"/>
                             <property name="hibernate.hbm2ddl.auto" value="validate" />
                             <property name="hibernate.show_sql" value="true" />
                             <property name="hibernate.query.startup_check" value="false" />
                            </properties>
                          </persistence-unit>
                          </persistence>

                          • 10. Re: Errors in named queries: TasksAssignedAsPotential Owner
                            ramkijbpm Newbie

                            As well, I have another question. Why would one want to restore the ksession? To get the tasks associated to a user, I can always use the TaskClient,

                             

                             

                             

                            TaskClient client =

                            new TaskClient(new MinaTaskClientConnector("web client", new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));

                            client.getTasksAssignedAsPotentialOwner(userId,

                            LANGUAGE, responseHandler);

                             

                             

                            Can I always create a new session when the server restarts. I am assuming the only reason we would persist the Ksession is to get the process instance using the sessionId? Is there a way to fetch an existing processInstance with a new ksession. Leads to the question, what is the recommendation as to the lifecycle of a ksession. Can I create new sessions always?