How to cast object in jBPM web service
shephc01 May 12, 2014 12:41 PMHello Team,
I have been cracking my head on how to do this. I have a web service where I am sending an Integer (ideally I want to send an Object) to the service and expecting an Object in return.
It appears as though the outbound SOAP message is working because in the console of my web service I can see the database query being returned. However, in JBoss BPMS I get the following error message
Process Instances failed to start: [FlightProject.flightProcess:18 - WS:5] -- org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane
The Plane object on my BPMS process (demo.flight.bpms.Plane) is identical in terms of column count, column names, column position etc to the Plane object on my web service (com.jboss.soap.service.acmedemo.Plane)
Any help will be appreciated. Unfortunately, all the examples I have seen so far either return a string or integer, but I want to return an object.
The console message for bpms looks as follows:
17:26:29,272 INFO [stdout] (http-localhost.localdomain/127.0.0.1:8280-9) Initializing the service variables: 2 17:26:29,384 INFO [org.apache.cxf.endpoint.dynamic.DynamicClientFactory] (http-localhost.localdomain/127.0.0.1:8280-9) Created classes: com.jboss.soap.service.acmedemo.ListAvailablePlanes, com.jboss.soap.service.acmedemo.ListAvailablePlanesResponse, com.jboss.soap.service.acmedemo.ObjectFactory, com.jboss.soap.service.acmedemo.Plane, com.jboss.soap.service.acmedemo.PlaneBooking, com.jboss.soap.service.acmedemo.PlaneBookingId 17:26:29,416 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8280-9) warning: [options] bootstrap class path not set in conjunction with -source 1.5 17:26:29,580 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8280-9) 1 warning 17:26:29,723 WARN [org.drools.persistence.SingleSessionCommandService] (http-localhost.localdomain/127.0.0.1:8280-9) Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:135) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:155) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:337) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:296) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:61) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:57) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:155) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:337) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:296) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:66) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:43) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:155) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:226) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:362) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:194) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:176) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:168) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.core.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1575) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.core.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:366) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:121) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:40) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.core.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:533) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:73) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:377) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:232) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.console.ng.bd.backend.server.KieSessionEntryPointImpl.startProcess(KieSessionEntryPointImpl.java:79) [jbpm-console-ng-business-domain-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.console.ng.bd.backend.server.KieSessionEntryPointImpl$Proxy$_$$_WeldClientProxy.startProcess(KieSessionEntryPointImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-console-ng-business-domain-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.console.ng.ht.backend.server.FormModelerProcessStarterEntryPointImpl.startProcessFromRenderContext(FormModelerProcessStarterEntryPointImpl.java:44) [jbpm-console-ng-human-tasks-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.console.ng.ht.backend.server.FormModelerProcessStarterEntryPointImpl$Proxy$_$$_WeldClientProxy.startProcessFromRenderContext(FormModelerProcessStarterEntryPointImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-console-ng-human-tasks-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6] at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source) [:1.7.0_09-icedtea] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea] at org.jboss.errai.bus.server.io.AbstractRPCMethodCallback.invokeMethodFromMessage(AbstractRPCMethodCallback.java:48) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.bus.server.io.ValueReplyRPCEndpointCallback.callback(ValueReplyRPCEndpointCallback.java:22) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.cdi.server.CDIExtensionPoints$3.callback(CDIExtensionPoints.java:499) [errai-weld-integration-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.bus.server.DeliveryPlan.deliver(DeliveryPlan.java:47) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:284) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:97) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:114) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:140) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3] at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.2.1.Final.jar:3.2.1.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.2.1.Final.jar:3.2.1.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.jbpm.designer.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:70) [jbpm-designer-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) [uberfire-security-server-0.3.2-redhat-6.jar:0.3.2-redhat-6] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:499) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:389) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea] Caused by: org.jbpm.bpmn2.handler.WorkItemHandlerRuntimeException: org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane at org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler.handleException(AbstractLogOrThrowWorkItemHandler.java:40) [jbpm-workitems-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler.handleException(AbstractLogOrThrowWorkItemHandler.java:23) [jbpm-workitems-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler.executeWorkItem(WebServiceWorkItemHandler.java:175) [jbpm-workitems-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:56) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:124) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] ... 76 more Caused by: org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:188) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerEvent(ExtendedNodeInstanceImpl.java:56) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:43) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:286) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:265) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:275) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:337) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:313) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:403) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:134) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6] at org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler.executeWorkItem(WebServiceWorkItemHandler.java:116) [jbpm-workitems-6.0.2-redhat-6.jar:6.0.2-redhat-6] ... 78 more Caused by: java.lang.ClassCastException: com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane at demo.flight.bpms.flightproject.Process_demo$u46$flight$u46$bpms$u46$flightproject$u46$flightProcess1828573978Action3Invoker.execute(Process_demo$u46$flight$u46$bpms$u46$flightproject$u46$flightProcess1828573978Action3Invoker.java:12) at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:182) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6] ... 88 more