When I configure the Task Server(org.drools.task) to be JTA I get the
following error when adding a Human Task work item. Is the following
Persistence Unit configuration valid? It works when the org.drools.task
trans type is set to LOCAL_RESOURCE.
Using drools 5.1.0.M1 in JBoss 5.1
<?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.drools.persistence.jpa"
transaction-type="JTA"
<provider>org.hibernate.ejb.HibernatePersistence</provider
<jta-data-source>java:/processInstanceDS</jta-data-source
<mapping-file>META-INF/orm.xml</mapping-file
<class>org.drools.persistence.session.SessionInfo</class
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class
<class>org.drools.persistence.processinstance.WorkItemInfo</class
<class>org.drools.persistence.processinstance.variabletypes.JPAPersisted
Variable</class
<class>org.drools.persistence.processinstance.variabletypes.VariableInst
anceInfo</class
<properties
<property name="hibernate.dialect"
value="org.hibernate.dialect.SQLServerDialect" /
<property name="hibernate.max_fetch_depth"
value="3"
/
<property name="hibernate.show_sql" value="true"
/
<property name="hibernate.hbm2ddl.auto"
value="update"
/
<property name="hibernate.connection.release_mode"
value="auto" /
<property
name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" /
<property
name="jboss.entity.manager.factory.jndi.name"
value="java:/WorkflowServerPU" /
</properties
</persistence-unit
<persistence-unit name="org.drools.task" transaction-type="
RESOURCE_LOCAL"
<provider>org.hibernate.ejb.HibernatePersistence</provider
<jta-data-source>java:/processInstanceDS</jta-data-source
<mapping-file>META-INF/taskorm.xml</mapping-file
<class>org.drools.task.Attachment</class
<class>org.drools.task.Content</class
<class>org.drools.task.BooleanExpression</class
<class>org.drools.task.Comment</class
<class>org.drools.task.Deadline</class
<class>org.drools.task.Comment</class
<class>org.drools.task.Deadline</class
<class>org.drools.task.Delegation</class
<class>org.drools.task.Escalation</class
<class>org.drools.task.Group</class
<class>org.drools.task.I18NText</class
<class>org.drools.task.Notification</class
<class>org.drools.task.EmailNotification</class
<class>org.drools.task.EmailNotificationHeader</class
<class>org.drools.task.PeopleAssignments</class
<class>org.drools.task.Reassignment</class
<class>org.drools.task.Status</class
<class>org.drools.task.Task</class
<class>org.drools.task.TaskData</class
<class>org.drools.task.SubTasksStrategy</class
<class>org.drools.task.OnParentAbortAllSubTasksEndStrategy</class
<class>org.drools.task.OnAllSubTasksEndParentEndStrategy</class
<class>org.drools.task.User</class
<properties
<property name="hibernate.dialect"
value="org.hibernate.dialect.SQLServerDialect" /
<property name="hibernate.max_fetch_depth"
value="3"
/
<property name="hibernate.show_sql" value="true"
/
<property name="hibernate.hbm2ddl.auto"
value="update"
/
<property name="hibernate.connection.release_mode"
value="auto" /
<property
name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" /
<property
name="jboss.entity.manager.factory.jndi.name"
value="java:/WorkflowServerPU" /
</properties
</persistence-unit
</persistence
10:48:22,887 INFO [STDOUT] Hibernate: update WorkItemInfo set
creationDate=?, name=?, processInstanceId=?, state=?, OPTLOCK=?,
workItemByteArray=? where workItemId=? and OPTLOCK=?
10:48:22,887 INFO [STDOUT] [2010:01:20 10:01:887:debug] Message
receieved on server : AddTaskRequest
10:48:22,887 INFO [STDOUT] [2010:01:20 10:01:887:debug] Arguments :
[org.drools.task.Task@537c3c9e,
org.drools.task.service.ContentData@b2a90]
10:48:22,887 INFO [STDOUT] [2010:01:20 10:01:887:exception] A JTA
EntityManager cannot use getTransaction()
10:48:22,887 INFO [STDOUT] java.lang.IllegalStateException: A JTA
EntityManager cannot use getTransaction()
10:48:22,887 INFO [STDOUT] at
org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntit
yManagerImpl.java:324)
10:48:22,887 INFO [STDOUT] at
org.drools.task.service.TaskServiceSession.doOperationInTransaction(Task
ServiceSession.java:676)
10:48:22,887 INFO [STDOUT] at
org.drools.task.service.TaskServiceSession.addTask(TaskServiceSession.ja
va:118)
10:48:22,887 INFO [STDOUT] at
org.drools.task.service.TaskServerHandler.messageReceived(TaskServerHand
ler.java:88)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.message
Received(DefaultIoFilterChain.java:752)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageRec
eived(DefaultIoFilterChain.java:414)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Defaul
tIoFilterChain.java:49)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messag
eReceived(DefaultIoFilterChain.java:832)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputIm
pl.flush(ProtocolCodecFilter.java:379)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(Protoco
lCodecFilter.java:173)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageRec
eived(DefaultIoFilterChain.java:414)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Defaul
tIoFilterChain.java:49)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messag
eReceived(DefaultIoFilterChain.java:832)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilt
er.java:95)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageRec
eived(DefaultIoFilterChain.java:414)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Defaul
tIoFilterChain.java:49)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messag
eReceived(DefaultIoFilterChain.java:832)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$HeadFilter.message
Received(DefaultIoFilterChain.java:616)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageRec
eived(DefaultIoFilterChain.java:414)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceive
d(DefaultIoFilterChain.java:408)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPol
lingIoProcessor.java:578)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(Abstract
PollingIoProcessor.java:540)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(Abstract
PollingIoProcessor.java:532)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(Abstr
actPollingIoProcessor.java:58)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Worker.run(Abstr
actPollingIoProcessor.java:857)
10:48:22,887 INFO [STDOUT] at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.j
ava:51)
10:48:22,887 INFO [STDOUT] at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.java:651)
10:48:22,887 INFO [STDOUT] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:676)
10:48:22,887 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
10:48:22,887 ERROR [STDERR] java.lang.IllegalStateException: A JTA
EntityManager cannot use getTransaction()
10:48:22,887 ERROR [STDERR] at
org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntit
yManagerImpl.java:324)
10:48:22,887 ERROR [STDERR] at
org.drools.task.service.TaskServiceSession.doOperationInTransaction(Task
ServiceSession.java:676)
10:48:22,887 ERROR [STDERR] at
org.drools.task.service.TaskServiceSession.addTask(TaskServiceSession.ja
va:118)
10:48:22,887 ERROR [STDERR] at
org.drools.task.service.TaskServerHandler.messageReceived(TaskServerHand
ler.java:88)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.message
Received(DefaultIoFilterChain.java:752)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageRec
eived(DefaultIoFilterChain.java:414)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Defaul
tIoFilterChain.java:49)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messag
eReceived(DefaultIoFilterChain.java:832)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputIm
pl.flush(ProtocolCodecFilter.java:379)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(Protoco
lCodecFilter.java:173)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageRec
eived(DefaultIoFilterChain.java:414)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Defaul
tIoFilterChain.java:49)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messag
eReceived(DefaultIoFilterChain.java:832)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilt
er.java:95)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageRec
eived(DefaultIoFilterChain.java:414)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(Defaul
tIoFilterChain.java:49)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messag
eReceived(DefaultIoFilterChain.java:832)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain$HeadFilter.message
Received(DefaultIoFilterChain.java:616)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageRec
eived(DefaultIoFilterChain.java:414)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceive
d(DefaultIoFilterChain.java:408)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPol
lingIoProcessor.java:578)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(Abstract
PollingIoProcessor.java:540)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(Abstract
PollingIoProcessor.java:532)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(Abstr
actPollingIoProcessor.java:58)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Worker.run(Abstr
actPollingIoProcessor.java:857)
10:48:22,887 ERROR [STDERR] at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.j
ava:51)
10:48:22,887 ERROR [STDERR] at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.java:651)
10:48:22,887 ERROR [STDERR] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:676)
10:48:22,887 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
10:48:22,903 INFO [LoggingFilter] SENT: HeapBuffer[pos=0 lim=2200
cap=4096: 00 00 08 94 AC ED 00 05 73 72 01 00 1F 6F 72 67...]
10:48:22,903 INFO [LoggingFilter] SENT: HeapBuffer[pos=0 lim=0 cap=0:
empty]
10:48:22,903 INFO [STDOUT] [2010:01:20 10:01:903:debug] Message
receieved on client : AddTaskResponse
10:48:22,903 INFO [STDOUT] [2010:01:20 10:01:903:debug] Arguments :
[java.lang.IllegalStateExcep