我们在尝试从Java启动jBPM工作流时遇到以下错误。
Exception in thread "main" org.kie.remote.client.api.exception.RemoteApiException: IllegalStateException thrown with message 'Could not unmarshall user-defined class instance parameter of type 'jaxbListWrapper'':
java.lang.IllegalStateException: Could not unmarshall user-defined class instance parameter of type 'jaxbListWrapper'
at org.kie.remote.services.cdi.ProcessRequestBean.verifyObjectHasBeenUnmarshalled(ProcessRequestBean.java:219)
at org.kie.remote.services.cdi.ProcessRequestBean.checkThatUserDefinedClassesWereUnmarshalled(ProcessRequestBean.java:208)
at org.kie.remote.services.cdi.ProcessRequestBean.preprocessCommand(ProcessRequestBean.java:183)
at org.kie.remote.services.cdi.ProcessRequestBean.processCommand(ProcessRequestBean.java:133)
at org.kie.remote.services.cdi.ProcessRequestBean$Proxy$_$$_WeldClientProxy.processCommand(Unknown Source)
at org.kie.remote.services.rest.ResourceBase.restProcessJaxbCommandsRequest(ResourceBase.java:153)
at org.kie.remote.services.rest.ExecuteResourceImpl.execute(ExecuteResourceImpl.java:30)
at org.kie.remote.services.rest.ExecuteResourceImpl$Proxy$_$$_WeldClientProxy.execute(Unknown Source)
at sun.reflect.GeneratedMethodAccessor236.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:237)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)
at org.kie.remote.services.rest.jaxb.DynamicJaxbContextFilter.doFilter(DynamicJaxbContextFilter.java:45)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
at org.uberfire.ext.security.server.BasicAuthSecurityFilter.doFilter(BasicAuthSecurityFilter.java:53)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
at org.uberfire.ext.security.server.SecureHeadersFilter.doFilter(SecureHeadersFilter.java:53)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
at org.uberfire.ext.security.server.SecurityIntegrationFilter.doFilter(SecurityIntegrationFilter.java:64)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeRestCommand(AbstractRemoteCommandObject.java:457)
at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeCommand(AbstractRemoteCommandObject.java:128)
at org.kie.services.client.api.command.KieSessionClientCommandObject.startProcess(KieSessionClientCommandObject.java:257)
at com.aia.poc.jbpmclient.App.startProcess(App.java:62)
at com.aia.poc.jbpmclient.App.main(App.java:27)
该进程接受java.util.List类型的参数,并且在bpmn文件的process变量中定义相同的参数。
以下代码用于启动流程。
public static void startProcess() throws MalformedURLException {
KieSession kSession = connManager.getKieSession(DEPLOYMENT_ID, USER_ID,
PASSWORD);
Map<String, Object> params = new HashMap<String, Object>();
List<String> listOfUsers = new ArrayList<String>();
listOfUsers.add("admin");
listOfUsers.add("pavan");
params.put("list_of_users", listOfUsers);
kSession.startProcess("com.sample.bpmn", params);
}
正在正确建立连接,我们可以使用null作为参数来触发进程。
答案 0 :(得分:2)
这似乎是一个已知问题。以下链接提供两种解决方案。
答案 1 :(得分:1)
我正在使用jBPM 6.2并使用start事件发出信号(请注意我不调用startProcess,但我调用signalEvent)可以正常工作,并将ArrayList作为参数。
KieHelper kieHelper = new KieHelper();
KieBase kieBase = kieHelper.addResource(ResourceFactory.newClassPathResource("workflow.bpmn2")).build();
KieSession ksession = kieBase.newKieSession();
// Added some service task listeners etc...
ArrayList<CustomObject> signalData = new ArrayList<CustomObject>();
CustomObject argument1 = new CustomObject();
CustomObject argument2 = new CustomObject();
signalData.add(argument1);
signalData.add(argument2);
ksession.signalEvent("EventName", signalData);
实际上,发信号通知启动过程与调用start方法没有太大区别。在这种情况下它可能会有所不同......
希望我帮忙!