3 Replies Latest reply: Mar 20, 2012 1:15 AM by 宇平 王 RSS

how to create a project for taskservice ?

宇平 王 Newbie

When i create a jbpm project with eclipse,and creat taseservice code in main method, and all the packages has include in the project.But when run the project , a error occured at the red line, like this:

Exception in thread "main" java.lang.IllegalArgumentException: Named query not found: UnescalatedDeadlines

          at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108)

          at org.jbpm.task.service.TaskService.<init>(TaskService.java:109)

          at org.jbpm.task.service.TaskService.<init>(TaskService.java:92)

          at org.jbpm.DemoTaskService.main(DemoTaskService.java:93)

 

 

the mian method code like this:

 

    EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.task");
  
   TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());

 

 

   MinaTaskServer server = new MinaTaskServer( taskService );

 

 

   Thread thread = new Thread( server );

 

 

   thread.start();

 

 

the persistence.xml like this:

 

<?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.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.MySQLDialect"/>

      <property name="hibernate.connection.driver_class" value="org.gjt.mm.mysql.Driver"/>

      <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/jbpm5"/>

      <property name="hibernate.connection.username" value="root"/>

      <property name="hibernate.connection.password" value="root"/>

      <property name="hibernate.connection.autocommit" value="true" />

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

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

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

    </properties>

  </persistence-unit>

</persistence>