Rajan Bansal [
http://community.jboss.org/people/rajan01] created the discussion
"Re: Running humantasks with HumanTaskService(Running in JBoss)"
To view the discussion, visit:
http://community.jboss.org/message/627353#627353
--------------------------------------------------------------
Hi ,
Actually I want to run the stand-alone service *"HumanTaskService"* via Jboss
but not by ant.
And in this I want my Oracle database is used for all the transactions instead of its own
db.
So I make the necessary changes in the *+jbpm-human-task-5.1.0.Final.jar:+*
I changed the Persistence.xml as I used the JTA data-source for it:
<persistence-unit name="org.jbpm.task" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
* <jta-data-source>java:/testDS1</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>
And my datasource is:
<datasources>
<xa-datasource>
<jndi-name>testDS1</jndi-name>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property
name="URL">jdbc:oracle:thin:@172.xx.x.251:1521:lupin</xa-datasource-property>
<user-name>xxxxx</user-name>
<password>xxxxx</password>
</xa-datasource>
</datasources>
It is successfully deployed in the jboss.
But when I want to start "humantaskservice" code in the JBoss then it gives the
following error when I am trying to add users:
public void startTaskService() {
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.jbpm.task");
TaskService taskService = new TaskService(emf,
SystemEventListenerFactory.getSystemEventListener());
TaskServiceSession taskSession = taskService.createSession();
// Add users
Map vars = new HashMap();
Reader reader = new InputStreamReader( StartTaskService.class.getResourceAsStream(
"LoadUsers.mvel" ) );
Map<String, User> users = ( Map<String, User> ) eval( reader, vars
);
for ( User user : users.values() ) {
taskSession.addUser( user );
}
reader = new InputStreamReader( StartTaskService.class.getResourceAsStream(
"LoadGroups.mvel" ) );
Map<String, Group> groups = ( Map<String, Group> ) eval( reader, vars
);
for ( Group group : groups.values() ) {
taskSession.addGroup(group);
}
// start server
MinaTaskServer server = new MinaTaskServer(taskService);
Thread thread = new Thread(server);
thread.start();
taskSession.dispose();
System.out.println("Task service started correctly !");
System.out.println("Task service running ...");
}
*the error is:*
10:23:18,772 INFO [SchemaExport] Running hbm2ddl schema export
10:23:18,772 INFO [SchemaExport] exporting generated schema to database
10:23:20,895 INFO [SchemaExport] schema export complete
10:23:20,895 INFO [NamingHelper] JNDI InitialContext properties:{}
10:23:21,238 INFO [STDOUT] Hibernate: select task0_.id as col_0_0_, deadline1_.id as
col_1_0_, deadline1_.deadline_date as col_2_0_ from Task task0_, Deadline deadline1_ where
(deadline1_.id in (select startdeadl2_.id from Deadline startdeadl2_ where
task0_.id=startdeadl2_.Deadlines_StartDeadLine_Id) or deadline1_.id in (select
enddeadlin3_.id from Deadline enddeadlin3_ where
task0_.id=enddeadlin3_.Deadlines_EndDeadLine_Id)) and deadline1_.escalated=0 order by
deadline1_.deadline_date
10:23:21,659 INFO [STDOUT] Adding userss........
*10:23:21,691 ERROR [[springmvc]] Servlet.service() for servlet springmvc threw
exception*
*java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()*
at
org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:324)
at
org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:811)
at
org.jbpm.task.service.TaskServiceSession.persistInTransaction(TaskServiceSession.java:786)
at org.jbpm.task.service.TaskServiceSession.addUser(TaskServiceSession.java:69)
at com.service.StartTaskService.startTaskService(StartTaskService.java:54)
at com.service.HumanTaskService.startHumanTask(HumanTaskService.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:471)
at
org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:408)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
10:25:21,982 INFO [ServletContextListener] Welcome to Seam 2.1.0.SP1
10:25:30,353 WARN [Component] Component class should be serializable: org.jboss.
please tell me what to do.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/627353#627353]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]