Discussion:
[jboss-user] [jBPM] - Re: Issue with StatefulKnowledgeSession
Maciej Swiderski
2013-03-29 16:43:09 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Issue with StatefulKnowledgeSession"

To view the discussion, visit: https://community.jboss.org/message/805545#805545

--------------------------------------------------------------
have you declared jbpm runtime engine entities in the persistence.xml? I see that you use org.jbpm.task persistence unit and if that is default it does not have runtime engine entities declared and thus persistence does not work as expected for ksession.

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805545#805545]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
irshad mansuri
2013-04-01 06:14:02 UTC
Permalink
irshad mansuri [https://community.jboss.org/people/irs] created the discussion

"Re: Issue with StatefulKnowledgeSession"

To view the discussion, visit: https://community.jboss.org/message/805776#805776

--------------------------------------------------------------
Hi Maciej

   Thanks for the reply. As per your guidence i went through the persistence.xml, this is my persistence.xml file

<?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
                                 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd 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 http://java.sun.com/xml/ns/persistence/orm_1_0.xsd http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
    xmlns:orm=" http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
    xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence">

    <persistence-unit name="org.jbpm.persistence.jpa">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <mapping-file>META-INF/JBPMorm.xml</mapping-file>
        <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>

        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        <class>org.drools.persistence.info.WorkItemInfo</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>

        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />
            <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver" />
            <property name="hibernate.connection.url"
                value="jdbc:jtds:sqlserver://localhost;DatabaseName=jbpmProcess" />
            <property name="hibernate.connection.username" value="sa" />
            <property name="hibernate.connection.password" value="***@123" />
            <property name="hibernate.connection.autocommit" value="false" />
            <property name="hibernate.max_fetch_depth" value="3" />
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.show_sql" value="false" />
        </properties>

    </persistence-unit>

    <persistence-unit name="org.jbpm.task">
        <!-- Task Class -->
        <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>

        <!-- Session Class -->
        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        <class>org.drools.persistence.info.WorkItemInfo</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>

        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />
            <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver" />
            <property name="hibernate.connection.url"
                value="jdbc:jtds:sqlserver://localhost;DatabaseName=task" />
            <property name="hibernate.connection.username" value="sa" />
            <property name="hibernate.connection.password" value="****" />
            <property name="hibernate.connection.autocommit" value="false" />
            <property name="hibernate.max_fetch_depth" value="3" />
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.show_sql" value="false" />
        </properties>
    </persistence-unit>
</persistence>


Regards
Irshad
.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805776#805776]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
irshad mansuri
2013-04-11 05:07:47 UTC
Permalink
irshad mansuri [https://community.jboss.org/people/irs] created the discussion

"Re: Issue with StatefulKnowledgeSession"

To view the discussion, visit: https://community.jboss.org/message/807608#807608

--------------------------------------------------------------
I am still facing the IInvocationTargetException.I am using jbpm 5.4,  when  creating the StatefulKnowledgeSession without JPAKnowledgeService it is starting the process and executing, but with JPAKnowledgeService it is showing InvocationTargetException. I want to use JPAKnowledgeService to store the session in to the database and again reload it when required using JPAKnowledgeService.loadStatefulKnowledgeSession.
I have attaced the related fles and event the log which i am getting while running the process in eclipse.


regards,
Irshad
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807608#807608]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Sandra Renaud
2013-04-11 08:15:00 UTC
Permalink
Sandra Renaud [https://community.jboss.org/people/joploya] created the discussion

"Re: Issue with StatefulKnowledgeSession"

To view the discussion, visit: https://community.jboss.org/message/807622#807622

--------------------------------------------------------------
Hello,

I encountered a problem like yours.

After looking at other post I make these changes :

in persistent.xml :

<!-- jbpm Session -->
        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        <class>org.drools.persistence.info.WorkItemInfo</class>


And the POM, I add the dependency for drools 5.5 :

<dependency>
                         <groupId>org.drools</groupId>
                         <artifactId>drools-compiler</artifactId>
                         <version>5.5.0.Final</version>
                    </dependency>


Regards,
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807622#807622]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
irshad mansuri
2013-04-11 09:29:51 UTC
Permalink
irshad mansuri [https://community.jboss.org/people/irs] created the discussion

"Re: Issue with StatefulKnowledgeSession"

To view the discussion, visit: https://community.jboss.org/message/807658#807658

--------------------------------------------------------------
Thanks for the reply sandra,
I am already having these class files in persistence.xml file and even the dependency which you mentioned is there. I debuged the code and on executing StatefulKnowledgeSession with JPASercive its throwing the error.I think it not able to get session for the kbase.


Regards ,
Irshad
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807658#807658]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
irshad mansuri
2013-04-12 12:32:30 UTC
Permalink
irshad mansuri [https://community.jboss.org/people/irs] created the discussion

"Re: Issue with StatefulKnowledgeSession"

To view the discussion, visit: https://community.jboss.org/message/808002#808002

--------------------------------------------------------------
Found the solution.

It was my mistake i was not adding the transaction type to the persistence

so as i changed my persistence.xml file it worked fine for me.

I made the following changes in my persistence.xml file

| <persistence-unit name="org.jbpm.task" transaction-type="JTA"> | |

and also add the transaction manager because trasaction manager is requiered if we are using JTA.

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

Regards
Irshad
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/808002#808002]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...