2 Replies Latest reply on Aug 6, 2012 2:21 AM by gvallangca

    NullPointerException when instantiating TaskService to start MinaTaskServer

    gvallangca Newbie

      Hi,

       

      I'm having a problem running my code to start my MinaTaskServer. I'm encountering a NullPointerException to the highlighted red line.

       

          @PersistenceContext(unitName = "org.jbpm.persistence.jpa")

                private EntityManager em;

       

           public void startMinaServer() throws Exception {

                System.out.println("********** Initializing MinaTask Server **********");

                          System.out.println("em.getEntityManagerFactory(): " + em.getEntityManagerFactory());

                          System.out.println("SystemEventListenerFactory.getSystemEventListener(): " + SystemEventListenerFactory.getSystemEventListener());

                          TaskService taskService = new TaskService(em.getEntityManagerFactory(), SystemEventListenerFactory.getSystemEventListener());

                          TaskServiceSession taskSession = taskService.createSession();

                          taskSession.addUser(new User("gvallangca"));

                          minaServer = new MinaTaskServer(taskService);

                          minaThread = new Thread(minaServer);

                          minaThread.start();

            }

       

       

      This is what is written in my persistence.xml:

       

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

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

              <jta-data-source>java:jdbc/jbpm</jta-data-source>

              <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>          

              <class>org.drools.persistence.info.SessionInfo</class>

              <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

              <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>

              <class>org.drools.persistence.info.WorkItemInfo</class>

              <properties>

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

              </properties>

        </persistence-unit>

       

       

      Can anybody help me to determine what's wrong or missing?

      Thank you so much.