JBPM 5.4使用自定义类对象作为信号事件中的参数

时间:2013-10-15 09:33:16

标签: jbpm

我已经将jbpm 5.4设置为tomcat上的Web应用程序,使用Bitronix作为使用Spring的事务管理器。当我尝试使用自定义类对象作为signalEvent

的事件参数来发出事件信号时
ErrorNode en = new ErrorNode(e.getMessage(), "abc", workItem.getId());
ksession.getProcessInstance(workItem.getProcessInstanceId())
                .signalEvent("error", en);

我收到以下异常。如果我将ErrorNode对象替换为仅包含字符串或其他基本类型的StringHashMap,则此错误消失。任何了解这种情况发生的原因都会有所帮助。使用自定义对象时是否存在我缺少的配置?我已声明signal事件的VariableName属性包含此errorNode对象,该对象被声明为相应类型的过程变量。

  

编辑:如果您是jbpm开发人员,您可能希望查看此错误,但并未表明它实际上是   程序员方面的序列化错误导致了这一点   错误。实际的异常不会传播到输出。

java.lang.RuntimeException: Could not commit session or rollback
    at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:406)
    at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381)
    at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:223)
    at services.StartProcess.h2startProcess(StartProcess.java:37)
    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.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:931)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: Unable to rollback transaction
    at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:85)
    at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402)
    ... 35 more
Caused by: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:818)
    at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.rollback(DroolsSpringTransactionManager.java:79)
    ... 36 more

1 个答案:

答案 0 :(得分:1)

进一步分析后,我发现错误会导致Persistence类中出现IOException。班级ErrorNode必须实施Serializable,而这应该是诀窍

  

编辑:如果你是一个jbpm开发人员,你可能想看看上面的错误跟踪,但没有说明它实际上是   程序员方面的序列化错误导致了这一点   错误。实际的异常不会传播到输出。