0 Replies Latest reply on Mar 21, 2012 9:51 AM by ramkijbpm

    KSession persistence and problems!

    ramkijbpm

      I get this very 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>

       

       

       

       

      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?