Problem configuring jBPM4 with Spring
bogdanj Jul 30, 2009 10:44 AMHi
I have a problem related to configuring jBPM 4 and Spring.
Here is jbpm.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?> <jbpm-configuration> <import resource="jbpm.jpdl.cfg.xml" /> <import resource="jbpm.identity.cfg.xml" /> <import resource="jbpm.jobexecutor.cfg.xml" /> <process-engine-context> <repository-service /> <repository-cache /> <execution-service /> <history-service /> <management-service /> <identity-service /> <task-service /> <!-- Here we needed to change the transaction interceptor to spring-transaction-interceptor --> <command-service> <spring-transaction-interceptor /> <retry-interceptor type="jta" /> <environment-interceptor /> </command-service> <!-- Added spring as read-context --> <script-manager default-expression-language="juel" default-script-language="juel" read-contexts="execution, environment, process-engine, spring" write-context=""> <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" /> </script-manager> <authentication /> <id-generator /> <types resource="jbpm.variable.types.xml" /> <address-resolver /> <business-calendar> <monday hours="9:00-12:00 and 12:30-17:00" /> <tuesday hours="9:00-12:00 and 12:30-17:00" /> <wednesday hours="9:00-12:00 and 12:30-17:00" /> <thursday hours="9:00-12:00 and 12:30-17:00" /> <friday hours="9:00-12:00 and 12:30-17:00" /> <holiday period="01/07/2008 - 31/08/2008" /> </business-calendar> <mail-template name='task-notification'> <to users="${task.assignee}" /> <subject>${task.name}</subject> <text><![CDATA[Hi ${task.assignee}, Task "${task.name}" has been assigned to you. ${task.description} Sent by JBoss jBPM ]]></text> </mail-template> <mail-template name='task-reminder'> <to users="${task.assignee}" /> <subject>${task.name}</subject> <text><![CDATA[Hey ${task.assignee}, Do not forget about task "${task.name}". ${task.description} Sent by JBoss jBPM ]]></text> </mail-template> </process-engine-context> <transaction-context> <transaction type="jta" /> <repository-session /> <db-session /> <message-session /> <timer-session /> <history-session /> <mail-session> <mail-server> <session-properties resource="jbpm.mail.properties" /> </mail-server> </mail-session> <!-- Need to set explicitly that we don't want jbpm to create sessions --> <hibernate-session current="true" /> </transaction-context> </jbpm-configuration>
In Spring applicationContext I have defined the following
<!-- jBPM related beans --> <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration"> <constructor-arg value="jbpm.cfg.xml" /> </bean> <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" /> <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /> <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
When trying to execute something like:
NewDeployment deployment = repositoryService.createDeployment(); deployment.addResourceFromClasspath("com/webmedia/bes/jbpm/hello-world.jpdl.xml"); deployment.deploy();
I end up with:
by: org.jbpm.api.JbpmException: no environment for managing hibernate transaction at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:53) at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:89) at com.webmedia.bes.web.action.BudgetsBrowser.browse(BudgetsBrowser.java:87) 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)
I guess I am missing something obvious in the configuration. It wouldn't be the first time, if somebody can help, I would be very thankful.