-
1. Re: Instantiating a process in JBPM5
salaboy21 Aug 2, 2011 9:07 PM (in response to imran.h)The error is pretty clear:
Unknown process ID: Evaluation
Check inside the Evaluation.bpmn file and look inside the process tag (<process id="....">) for the id attribute.
When you want to start a process you should use the id that is specified inside that attribute.
If that works we can see what is missing in hibernate, because you will get a different error.
Cheers
-
2. Re: Instantiating a process in JBPM5
imran.h Aug 2, 2011 9:42 PM (in response to salaboy21)Right. that worked. I'm now getting:
java.lang.ClassNotFoundException: javax.persistence.EntityManager
My project is a non-jpa hibernate project and doesnt use an Entity Manager. Can I manually add all the jbpm entities to my hibernate config file to get around this?
Thanks for your help.
-
3. Re: Instantiating a process in JBPM5
swiderski.maciej Aug 3, 2011 4:03 AM (in response to imran.h)Error you're getting is cause by usage od JPAWorkingMemoryDbLogger, since as its name implies it relies on JPA and entity manager.
You could try using WorkingMemoryDbLogger instead, this one is based on hibernate directly.
HTH
-
4. Re: Instantiating a process in JBPM5
imran.h Aug 3, 2011 6:45 PM (in response to swiderski.maciej)Thank you for your answer.
I took out the db logger for now.
I am getting the followin gexception:
java.lang.IllegalArgumentException: Could not connect task client
at org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler.connect(CommandBasedWSHumanTaskHandler.java:88)
at org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler.executeWorkItem(CommandBasedWSHumanTaskHandler.java:101)
at org.drools.process.instance.impl.DefaultWorkItemManager.internalExecuteWorkItem(DefaultWorkItemManager.java:70)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:105)
Evaluate.bpmn has manual tasks in it. According to the documentation I must initialize the TaskService as a separate service. The task service itself takes an instance of an EntitymanagerFactory:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.task");
TaskService taskService = new TaskService(emf);
MinaTaskServer server = new MinaTaskServer( taskService );
Thread thread = new Thread( server );
thread.start();
Is there any way of getting the task service without jpa?
-
5. Re: Instantiating a process in JBPM5
swiderski.maciej Aug 4, 2011 1:52 PM (in response to imran.h)Error you are getting is caused because client can't connect to you Task Service, as you mentioned you need first start Task Service.
I am afraid there is no way to go around JPA in Task Service, it is directly using JPA.
Cheers
-
6. Re: Instantiating a process in JBPM5
imran.h Aug 26, 2011 8:20 PM (in response to swiderski.maciej)I'm now setting up jbpm more traditionally through jpa. The aim is to have it embedded in my app. When I try to create my entity manager to instantiate the task service though, I get the following exception:
javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] class or package not found
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1092)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:871)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:758)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
Caused by: java.lang.ClassNotFoundException: org.drools.task.query.TaskSummary
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
Error in named query: SubTasksAssignedAsPotentialOwner
org.hibernate.hql.ast.QuerySyntaxException: Unable to locate class [org.drools.task.query.TaskSummary] [select new org.drools.task.query.TaskSummary( t.id, names.text, subjects.text, descriptions.text, t.taskData.status, t.priority, t.ta
skData.skipable, t.taskData.actualOwner, t.taskData.createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime) from org.jbpm.task.Task t left join t.taskData.createdBy left join t.taskData.actualOwner, org.jbp
m.task.I18NText names, org.jbpm.task.I18NText subjects, org.jbpm.task.I18NText descriptions, org.jbpm.task.OrganizationalEntity potentialOwners where t.taskData.parentId = :parentId and potentialOwners.id = :userId and potentialOwners in
elements ( t.peopleAssignments.potentialOwners ) and names.language = :language and names in elements( t.names) and ( subjects.language = :language and subjects in elements( t.subjects) or t.subjects.size = 0 ) and ( descriptions.langua
ge = :language and descriptions in elements( t.descriptions) or t.descriptions.size = 0 ) and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and t.taskData.expirationTime is null]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:235)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
The exception is obvious, but I had two questions:
1- Which jar has this class and where to I download it. I already have drools core and compiler jars.
2- Why do I need this jar. I think I have added everything I need according to the documentation.
Thanks in advance for your help.
-
7. Re: Instantiating a process in JBPM5
salaboy21 Aug 26, 2011 8:21 PM (in response to imran.h)do you have jbpm-persistence-jpa & jbpm-human-tasks? you need that to persist the task status for long runnning processes.
Cheers
-
8. Re: Instantiating a process in JBPM5
imran.h Aug 28, 2011 7:51 PM (in response to salaboy21)Yes I have both those jars. Neither of those contain the class TaskSummary. If it helps my code snippet is:
LOG.info("starting jbpm");
EntityManagerFactory emf = loadPrimaryConfig().buildEntityManagerFactory();//Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
TaskServiceSession taskSession = taskService.createSession();
The errors occur when I try to instatitiate the task service: TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
-
9. Re: Instantiating a process in JBPM5
salaboy21 Aug 28, 2011 9:01 PM (in response to imran.h)I think that's the problem:
Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
That's the one for session persistence. you should use org.jbpm.task.
TaskSummary is inside jbpm-human-task.jar I've just check it:
package org.jbpm.task.query;
...
public class TaskSummary
and the persistence.xml file looks like:
<?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="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="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
<property name="hibernate.connection.url" value="jdbc:h2:mem:mydb" />
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value="sasa"/>
<property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
Cheers
-
10. Re: Instantiating a process in JBPM5
imran.h Aug 29, 2011 8:30 PM (in response to salaboy21)Thanks for your help, thats worked.
-
11. Re: Instantiating a process in JBPM5
imran.h Sep 1, 2011 2:05 PM (in response to salaboy21)I am able to run a process end to end. But I need to eventually persist it for longer running processes and also for persistent tasks. For that I still need to use the "org.jbpm.persistence.jpa" persistence which throws the above exception:
Error in named query: SubTasksAssignedAsPotentialOwner
org.hibernate.hql.ast.QuerySyntaxException: Unable to locate class [org.drools.task.query.TaskSummary] [select new org.drools.task.query.TaskSummary( t.id, names.text, subjects.text, descriptions.text, t.taskData.status, t.priority, t.taskData.skipable, t.taskData.actualOwner, t.taskData.createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime) from org.jbpm.task.Task t left join t.taskData.createdBy left join t.taskData.actualOwner, org.jbpm.task.I18NText names, org.jbpm.task.I18NText subjects, org.jbpm.task.I18NText descriptions, org.jbpm.task.OrganizationalEntity potentialOwners where t.taskData.parentId = :parentId and potentialOwners.id = :userId and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and names.language = :language and names in elements( t.names) and ( subjects.language = :language and subjects in elements( t.subjects) or t.subjects.size = 0 ) and ( descriptions.language = :language and descriptions in elements( t.descriptions) or t.descriptions.size = 0 ) and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and t.taskData.expirationTime is null]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
This is talking about the drools TaskSummary class (org.drools.task.query.TaskSummary) and not the jbpm taskSummary class which, as you pointed out is in jbpm-human-task.jar
Please let me know if you need further info. Thanks.
-
12. Re: Instantiating a process in JBPM5
calca Sep 1, 2011 3:21 PM (in response to imran.h)Does the exception has the cause? I mean, could you please copy the full stack?
-
13. Re: Instantiating a process in JBPM5
imran.h Sep 1, 2011 4:47 PM (in response to calca)In my stderr.log I see this exception:
ESC[0mjavax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
Caused by: org.hibernate.HibernateException: Errors in named queries: TasksAssignedAsPotentialOwnerWithGroups, TasksOwned, TasksAssignedAsPotentialOwner, TasksAssignedAsRecipient, TasksAssignedAsTaskStakeholder, UnescalatedDeadlines, TasksAssignedAsExcludedOwner, TasksAssignedAsPotentialOwnerByGroup, GetSubTasksByPa
rentTaskId, TasksAssignedAsTaskInitiator, TasksAssignedAsBusinessAdministrator, SubTasksAssignedAsPotentialOwner
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:365)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 33 more
In my app log I see this exception:
[REQ:4ABE653B0B118.AC114F2C.267B6495]] Error in named query: SubTasksAssignedAsPotentialOwner
org.hibernate.hql.ast.QuerySyntaxException: Unable to locate class [org.drools.task.query.TaskSummary] [select new org.drools.task.query.TaskSummary( t.id, names.text, subjects.text, descriptions.text, t.taskData.status, t.priority, t.taskData.skipable, t.taskData.actualOwner, t.taskData.createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime) from org.jbpm.task.Task t left join t.taskData.createdBy left join t.taskData.actualOwner, org.jbpm.task.I18NText names, org.jbpm.task.I18NText subjects, org.jbpm.task.I18NText descriptions, org.jbpm.task.OrganizationalEntity potentialOwners where t.taskData.parentId = :parentId and potentialOwners.id = :userId and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and names.language = :language and names in elements( t.names) and ( subjects.language = :language and subjects in elements( t.subjects) or t.subjects.size = 0 ) and ( descriptions.language = :language and descriptions in elements( t.descriptions) or t.descriptions.size = 0 ) and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and t.taskData.expirationTime is null]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:235)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:402)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:352)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
There is no cause. The app log has a few more exceptions for other queries but the cause for all is the same, no TaskSummary.
-
14. Re: Instantiating a process in JBPM5
imran.h Sep 1, 2011 10:41 PM (in response to imran.h)Found the issue. My code was picking up the orm.xml in the drools jar instead of the jbpm one.