2
votes

I created a jBPM project choosing to add a default example which includes Human Tasks management. I changed the method JBPMHelper.startTaskService() by these instructions:

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();

But when I try to execute this simple example I get this error

Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.task] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
    at com.sample.ProcessMain.main(ProcessMain.java:24)
Caused by: org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection avalable
    at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:107)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:134)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

Knowing that when I type ant start.demo I get all the tools (jboss 7, eclipse, h2) but the human task not start. The message in the console is that it is not completed

start.human.task:
[javac] C:\jbpm-5.2.0.Final-installer-full\jbpm-installer\build.xml:647: 
warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; 
set to false for repeatable builds
 [java] Task service registered usergroup callback ...
 [java] Task service started correctly!
 [java] Task service running ...
2

2 Answers

1
votes

Starting the task service using the installer does seem to work correctly (when you seem the "Task service running ..." it started correctly). Note that this is a normal Java process that is running in the command, so it will not return, it will remain active like that and show log information in that console. Closing the command prompt (or pressing Ctrl-C) would terminate the task service. As of jBPM 5.2, you can also use a war you can deploy to the application server to run the task service as a service on the application server.

Regarding the other error you are getting, it seems you are missing the 'hibernate.dialect' property in your persistence configuration files. Did you just try to execute the sample that was generated, or did you modify it (and if so, why / how)?

Kris

0
votes

Sometimes when I start the server with ant start.demo command the deployment fails. You can check if the war files were deployed correctly in the dir: jboss-as-7.0.2.Final\standalone\deployments. For example if the jbpm console was deployed you should have the deployment file like : jbpm-gwt-console.war.deployed. Sometimes the server cannot deploy one of these. In this case just delete the failed deployment file and start again. In most of the cases the problem was solved for me.

Hunor