[JBoss jBPM] - Problem execute actions on jboss
by asmo
Hello!
I have some problems with exectue Actions on a jboss server. I ve made a little test definition with a start-state, a state and an end-state. The state should execute an action. In junit, the workflow runs without any problem. But when i deploy it on a jboss, jbpm doesn t execute the action. When i ask the processinstance for its node name, i can see, that the workflow runs form one state to another. But without executing the action. I ve tried serveral kinds of action ( befor-signal, after-signal...) but without any change. Can someone tell me, what i ve made wrong? ( once again a stupid error i ve produced?? )
I use jbpm 3.1.1. and the jboss 4.0.3.sp1
my processdefinition
<?xml version="1.0" encoding="UTF-8"?>
| <process-definition
| xmlns="http://jbpm.org/3/jpdl"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
| name="processActivity">
| <start-state name="start">
| <transition name="startWorkflow" to="createActivity">
| </transition>
| </start-state>
| <state name="createActivity">
| <transition name="created" to="end1"></transition>
| <event type="after-signal">
| <action name="action1" class="de.uniSiegen.crm.server.workflow.action.TestActivity"></action>
| </event>
| </state>
| <end-state name="end1"></end-state>
| </process-definition>
my simple action handler:
| package de.uniSiegen.crm.server.workflow.action;
|
| import org.jbpm.graph.def.ActionHandler;
| import org.jbpm.graph.exe.ExecutionContext;
|
| public class TestActivity implements ActionHandler {
|
| public void execute(ExecutionContext arg0) throws Exception {
|
| System.out.println(" in the test activity!!!!!");
| }
|
| }
I would be very grateful for any help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977196#3977196
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977196
19 years, 7 months
[JBoss Seam] - Re: Transaction problem after upgrade
by blue_due
Thanks, I removed the @Begin and @End annotations but no joy.
The stack trace is much the same. The exception is thrown when calling org.jboss.seam.core.ManagedJbpmContext.getJbpmContext().
I inserted breakpoints in org.jboss.seam.interceptors.TransactionInterceptor but found that the exception is being thrown after the interceptor has finished doing it's work. I modified Seam and annotated ManagedJbpmContext.getJbpmContext() with @Transactional to see what would happen and found that the behaviour was the same.
Admitedly, I'm at the limits of my (v. limited) understanding here. As far as I can tell the task is being ended; I'm just getting this annoying exception.
Here is the full stack trace:
| java.lang.IllegalStateException: JbpmContext may only be used inside a transaction
| at org.jboss.seam.core.ManagedJbpmContext.getJbpmContext(ManagedJbpmContext.java:71)
| at sun.reflect.GeneratedMethodAccessor170.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:17)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:82)
| at org.jboss.seam.Component.callComponentMethod(Component.java:1612)
| at org.jboss.seam.Component.unwrap(Component.java:1633)
| at org.jboss.seam.Component.getInstance(Component.java:1465)
| at org.jboss.seam.Component.getInstance(Component.java:1433)
| at org.jboss.seam.Component.getInstance(Component.java:1415)
| at org.jboss.seam.core.ManagedJbpmContext.instance(ManagedJbpmContext.java:112)
| at org.jboss.seam.core.ProcessInstance.getProcessInstance(ProcessInstance.java:42)
| at org.jboss.seam.core.ProcessInstance$$EnhancerByCGLIB$$fdc4d28.CGLIB$getProcessInstance$0(<generated>)
| at org.jboss.seam.core.ProcessInstance$$EnhancerByCGLIB$$fdc4d28$$FastClassByCGLIB$$8ec14899.invoke(<generated>)
| at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
| at org.jboss.seam.interceptors.JavaBeanInterceptor$3.proceed(JavaBeanInterceptor.java:187)
| at org.jboss.seam.ejb.SeamInterceptor.invokeInContexts(SeamInterceptor.java:220)
| at org.jboss.seam.ejb.SeamInterceptor.invoke(SeamInterceptor.java:186)
| at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:173)
| at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:158)
| at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:62)
| at org.jboss.seam.core.ProcessInstance$$EnhancerByCGLIB$$fdc4d28.getProcessInstance(<generated>)
| at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:17)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:82)
| at org.jboss.seam.Component.callComponentMethod(Component.java:1612)
| at org.jboss.seam.Component.unwrap(Component.java:1633)
| at org.jboss.seam.Component.getInstance(Component.java:1465)
| at org.jboss.seam.Component.getInstance(Component.java:1433)
| at org.jboss.seam.Component.getInstance(Component.java:1415)
| at org.jboss.seam.core.ProcessInstance.instance(ProcessInstance.java:58)
| at org.jboss.seam.contexts.BusinessProcessContext.getProcessInstance(BusinessProcessContext.java:210)
| at org.jboss.seam.contexts.BusinessProcessContext.getContextInstance(BusinessProcessContext.java:197)
| at org.jboss.seam.contexts.BusinessProcessContext.getNamesFromContext(BusinessProcessContext.java:103)
| at org.jboss.seam.contexts.BusinessProcessContext.getNames(BusinessProcessContext.java:92)
| at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:181)
| at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:362)
| at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:272)
| at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:108)
| at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:34)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977191#3977191
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977191
19 years, 7 months
[JBoss jBPM] - Re: sessions and forks
by pedrosacosta
Here is the SpawningMultipleTransitions
|
| public class SpawningMultipleTransitions extends Node implements Parsable, ActionHandler {
|
|
| private final Logger log = Logger.getLogger(getClass().getName());
|
|
| public void execute(ExecutionContext executionContext) {
| Token token = executionContext.getToken();
|
| // Get process instance
| Long pid = (Long) executionContext.getVariable("processInstanceId");
| JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
| ProcessInstance processInstance = jbpmContext.loadProcessInstance(pid);
| //---------------------------------------------
|
| // phase one: collect all the transitionNames
| List forkedTokens = new ArrayList();
|
| // by default, the fork spawns a token for each leaving transition
| Collection transitionNames = token.getNode().getLeavingTransitionsMap().keySet();
| //-------------------------
| //----------------------------------------
|
| // phase two: create forked tokens for the collected transition names
| Iterator iter = transitionNames.iterator();
| while (iter.hasNext()) {
| String transitionName = (String) iter.next();
| forkedTokens.add(createForkedToken(token, transitionName));
| }
| //---------------------------------------
|
| // phase three: launch child tokens from the fork over the given transitions
| iter = forkedTokens.iterator();
| while( iter.hasNext() ) {
|
| ForkedToken forkedToken = (ForkedToken) iter.next();
| Token childToken = forkedToken.token;
| String leavingTransitionName = forkedToken.leavingTransitionName;
|
| ExecutionContext childExecutionContext = new ExecutionContext(childToken);
| if (leavingTransitionName!=null) {
| childToken.getNode().leave(childExecutionContext, leavingTransitionName);
| jbpmContext.save(processInstance);
| jbpmContext.save(token);
| log.info("BEM-INFO: Process instance saved with id: " + processInstance.getId());//TODO:2DEL
|
| } else {
| childToken.getNode().leave(childExecutionContext);
| }
| }
| //---------------------------------
|
| jbpmContext.close();
| }
|
| protected ForkedToken createForkedToken(Token parent, String transitionName) {
| // instantiate the new token
| Token childToken = new Token(parent, getTokenName(parent, transitionName));
|
| // create a forked token
| ForkedToken forkedToken = new ForkedToken(childToken, transitionName);
|
| return forkedToken;
| }
|
| protected String getTokenName(Token parent, String transitionName) {
| String tokenName = null;
| if ( transitionName != null ) {
| if ( ! parent.hasChild( transitionName ) ) {
| tokenName = transitionName;
| } else {
| int i = 2;
| tokenName = transitionName + Integer.toString( i );
| while ( parent.hasChild( tokenName ) ) {
| i++;
| tokenName = transitionName + Integer.toString( i );
| }
| }
| } else { // no transition name
| int size = ( parent.getChildren()!=null ? parent.getChildren().size()+1 : 1 );
| tokenName = Integer.toString(size);
| }
| return tokenName;
| }
|
| static class ForkedToken {
| Token token = null;
| String leavingTransitionName = null;
| public ForkedToken(Token token, String leavingTransitionName) {
| this.token = token;
| this.leavingTransitionName = leavingTransitionName;
| }
| }
| }
|
Here is the method that is executed before enter SpawningMultipleTransitions
| public Map nextState(String transition, Long processInstanceId){
|
| beginSessionTransaction(); // inicializar JBPM object
| ProcessInstance processInstance = jbpmContext.loadProcessInstance(processInstanceId);
|
| Token token = processInstance.getRootToken();
| String previousNodeName = token.getNode().getName();
|
| token.signal();// It's here that enter in the
| // SpawningMultipleTransitions
|
| log.info("BEM-INFO: Node transition: PreviousNode --> ActualNode\n"
| + previousNodeName + " --> " + token.getNode().getName());//TODO:2DEL
|
| jbpmContext.save(processInstance);
| jbpmContext.save(token);
| log.info("BEM-INFO: Process instance saved with id: " + processInstance.getId());//TODO:2DEL
|
| commitAndCloseSession(); // commit and close JBPM objects
|
| return result;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977186#3977186
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977186
19 years, 7 months
[JBoss jBPM] - sessions and forks
by pedrosacosta
I'm using a fork in my process definition, but i want to persist in the DB the sibling tokens of the fork. The problem is, the way that i'm implementing this funcionality, i've
| HibernateException Illegal attempt to associate a collection with two open sessions
| error. The cause of the error is the following line inside SpawningMultipleTransitions:
| JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
|
The way i'm doing is:
processdefinition.xml
| ...
| <start-state name="start">
| <transition name="to_fork" to="Fork"></transition>
| </start-state>
| <fork name="Fork">
| <event type="node-enter">
| <action name="spawning" class="com.link.bem.jbpm.action.SpawningMultipleTransitions"/>
| </event>
| <transition name="Path_A" to="Acidentes_A1"></transition>
| <transition name="Path_B" to="Acidentes_B1"></transition>
| <transition name="Path_C" to="Acidentes_C1"></transition>
| <transition name="Path_D" to="Acidentes_D1"></transition>
| </fork>
| ...
|
The problem is, when i enter the fork, i've already a JbpmContext session opened. How can use the session opened before enter the SpawningMultipleTransitions inside this class, or how should i close the opened session before open a new one inside the SpawningMultipleTransitions?
I hope i've made myself clear.
Thanks,
Pedro
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977185#3977185
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977185
19 years, 7 months