cancel
Showing results for 
Search instead for 
Did you mean: 

Werservice task error: Parse XML java.lang.ClassCastException

krull80
Champ in-the-making
Champ in-the-making
Hello All,

I'm having a problem while deploying a diagram that is using a webservice task. While deploying the diagram:


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn"
   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
   xmlns:pub="http://mynamespace/services/publication-service/v0"
   xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema"
   expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://eu.oami.europe/flows/MarkCreation"
   xmlns:tns="http://eu.oami.europe/flows/MarkCreation">
   <import location="http://pc619155:8088/SendPublication?wsdl"
      namespace="http://mynamespace/services/publication-service/v0"
      importType="http://schemas.xmlsoap.org/wsdl/" />

   <message id="SendPublicationRequestMessage" itemRef="tns:SendPublicationRequestItem" />
   <message id="SendPublicationResponseMessage" itemRef="tns:SendPublicationResponseItem" />
   <itemDefinition id="SendPublicationRequestItem"
      structureRef="pub:SendPublicationRequest" />
   <itemDefinition id="SendPublicationResponseItem"
      structureRef="pub:SendPublicationResponse" />
   <interface name="Find customer address" implementationRef="pub:SendPublicationService">
      <operation id="SendPublicationOperation" name="Send a Publication Operation"
         implementationRef="pub:SendPublication">
         <inMessageRef>tns:SendPublicationRequestMessage</inMessageRef>
         <outMessageRef>tns:SendPublicationResponseMessage</outMessageRef>
      </operation>
   </interface>
   <itemDefinition id="name" structureRef="string" />
   <itemDefinition id="customerName" structureRef="string" />
   <itemDefinition id="address" structureRef="string" />
   <itemDefinition id="webserviceResponse" structureRef="string" />
   <process id="myProcess" name="My process" isExecutable="true"
      activiti:candidateStarterUsers="kermit,gonzo"
      activiti:candidateStarterGroups="management">
      <startEvent id="startFlowEvent" name="Start Validation Process"
         activiti:initiator="employeeName">
         <extensionElements>
            <activiti:formProperty id="tradeMarkBody"
               name="TradeMark Body Content" type="string" required="true"></activiti:formProperty>
            <activiti:formProperty id="tradeMarkBodyJSON"
               name="JSON Trade Mark  body" type="string" required="true"></activiti:formProperty>
            <activiti:formProperty id="TradeMarkIdentifier"
               name="Unique Trade Mark Identifier" type="string"></activiti:formProperty>
            <activiti:formProperty id="Publishable"
               name="Should it be published" type="string" required="true"></activiti:formProperty>
         </extensionElements>
      </startEvent>
      <exclusiveGateway id="validate_exclusive_gateway"
         name="Is Valid" gatewayDirection="Mixed"></exclusiveGateway>
      <scriptTask id="invalid_script_task" name="Script Task"
         scriptFormat="groovy" activiti:autoStoreVariables="true">
         <script>out:print "Operation is not valid"</script>
      </scriptTask>
      <sequenceFlow id="gateway_to_invalid_flow" name="Invalid Input"
         sourceRef="validate_exclusive_gateway" targetRef="invalid_script_task">
         <conditionExpression>${Publishable == 'false'}</conditionExpression>
      </sequenceFlow>
      <endEvent id="end_process_event" name="End"></endEvent>
      <sequenceFlow id="script_task_to_end_event" sourceRef="invalid_script_task"
         targetRef="end_process_event"></sequenceFlow>
      <serviceTask id="publish_service_task" name="Publish Service Task"
         implementation="##WebService" operationRef="tns:SendPublicationOperation">

         <ioSpecification>
            <dataInput id="dataInput" itemSubjectRef="tns:SendPublicationRequestItem" />
            <dataOutput id="dataOutput" itemSubjectRef="tns:SendPublicationResponseItem" />
            <inputSet>
               <dataInputRefs>dataInput</dataInputRefs>
            </inputSet>
            <outputSet>
               <dataOutputRefs>dataOutput</dataOutputRefs>
            </outputSet>
         </ioSpecification>
      </serviceTask>
      <sequenceFlow id="gateway_to_valid_flow" name="Valid Input"
         sourceRef="validate_exclusive_gateway" targetRef="publish_service_task">
         <conditionExpression>${Publishable == 'true'}</conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="publish_service_task_to_end_event"
         sourceRef="publish_service_task" targetRef="end_process_event"></sequenceFlow>
      <userTask id="validate_content_user_task" name="Validate Body Content"></userTask>
      <sequenceFlow id="start_event_to_validate_user_task_flow"
         sourceRef="startFlowEvent" targetRef="validate_content_user_task"></sequenceFlow>
      <sequenceFlow id="validate_user_task_to_gateway_flow"
         sourceRef="validate_content_user_task" targetRef="validate_exclusive_gateway"></sequenceFlow>
   </process>   
</definitions>


I'm having the following problem:

ADVERTENCIA: Exception or error caught in resource
org.activiti.engine.ActivitiException: Error parsing XML
        at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:195)
        at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:86)
        at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:42)
        at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:68)
        at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:33)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
        at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:74)
        at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:134)
        at org.activiti.rest.api.repository.DeploymentCollectionResource.uploadDeployment(DeploymentCollectionResource.java:117)
        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.restlet.resource.ServerResource.doHandle(ServerResource.java:449)
        at org.restlet.resource.ServerResource.post(ServerResource.java:1114)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:533)
        at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:590)
        at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:302)
        at org.restlet.resource.ServerResource.handle(ServerResource.java:849)
        at org.restlet.resource.Finder.handle(Finder.java:513)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Router.doHandle(Router.java:500)
        at org.restlet.routing.Router.handle(Router.java:740)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
        at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:75)
        at org.restlet.Application.handle(Application.java:391)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Router.doHandle(Router.java:500)
        at org.restlet.routing.Router.handle(Router.java:740)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.routing.Router.doHandle(Router.java:500)
        at org.restlet.routing.Router.handle(Router.java:740)
        at org.restlet.routing.Filter.doHandle(Filter.java:159)
        at org.restlet.routing.Filter.handle(Filter.java:206)
        at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
        at org.restlet.Component.handle(Component.java:391)
        at org.restlet.Server.handle(Server.java:491)
        at org.restlet.engine.ServerHelper.handle(ServerHelper.java:74)
        at org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:153)
        at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1031)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
        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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        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.ClassCastException: com.sun.codemodel.JCodeModel$JReferencedClass cannot be cast to com.sun.codemodel.JDefinedClass
        at org.activiti.engine.impl.webservice.CxfWSDLImporter.importStructure(CxfWSDLImporter.java:156)
        at org.activiti.engine.impl.webservice.CxfWSDLImporter.importTypes(CxfWSDLImporter.java:150)
        at org.activiti.engine.impl.webservice.CxfWSDLImporter.importFrom(CxfWSDLImporter.java:109)
        at org.activiti.engine.impl.webservice.CxfWSDLImporter.importFrom(CxfWSDLImporter.java:70)
        at org.activiti.engine.impl.bpmn.parser.BpmnParse.createImports(BpmnParse.java:273)
        at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:186)


I have deployed it in Tomcat 7.0.33 with java 1.6 and cxf 2.4.1 and 2.7.7 and java 1.7 with cxf 2.7.7 and 2.4.1 both with the same error.
I also tried in weblogic with similar result ( but it took me more time for solving weblogic class loading issues 😞 ).


The wsdl content is:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="http://mynamespace/services/publication-service/v0"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   name="PublicationService" xmlns:pub="http://mynamespace/dossier/publication/service/v0"
   targetNamespace="http://mynamespace/services/publication-service/v0">
   <wsdl:types>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:import namespace="http://mynamespace/dossier/publication/service/v0"
            schemaLocation="PublicationService.xsd">
         </xsd:import>
      </xsd:schema>
   </wsdl:types>

   <wsdl:message name="SendPublicationRequest">
      <wsdl:part element="pub:SendPublicationRequest" name="parameters" />
   </wsdl:message>
   
   <wsdl:message name="SendPublicationResponse">
      <wsdl:part element="pub:SendPublicationResponse" name="parameters" />
   </wsdl:message>
   
   <wsdl:message name="SendPublicationFault">
      <wsdl:part name="parameters" element="pub:RegistryFault"></wsdl:part>
   </wsdl:message>

   <wsdl:portType name="SendPublicationService">
      <wsdl:operation name="SendPublication">
         <wsdl:input message="tns:SendPublicationRequest" />
         <wsdl:output message="tns:SendPublicationResponse"/>
         <wsdl:fault name="fault" message="tns:SendPublicationFault"></wsdl:fault>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="SendPublicationSOAP" type="tns:SendPublicationService">
      <soap:binding style="document"
         transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="SendPublication">
         <soap:operation soapAction="" />
         <wsdl:input>
            <soap:body use="literal" />
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal" />
         </wsdl:output>
         <wsdl:fault name="fault">
            <soap:fault use="literal" name="fault" />
         </wsdl:fault>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="SendPublicationService">
      <wsdl:port binding="tns:SendPublicationSOAP" name="SendPublicationServiceSOAP">
         <soap:address location="http://localhost:8081/sendPublication" />
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

and the imported schema:


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   targetNamespace="http://mynamespace/dossier/publication/service/v0"
   xmlns:tns="http://mynamespace/dossier/publication/service/v0"   
   elementFormDefault="qualified">
   
   
   
   <!– OPERATIONS –>
   <xs:element name="SendPublicationRequest" type="xs:string" />
   
   <xs:element name="SendPublicationResponse">
      <xs:complexType>
         <xs:sequence/>
      </xs:complexType>
   </xs:element>
   
   <!– Generic exception fault –>
   <xs:element name="RegistryFault" type="xs:string">
      <xs:annotation>
         <xs:documentation>
            The default message soap fault.
         </xs:documentation>
      </xs:annotation>
   </xs:element>
</xs:schema>


I hope you can help me with this issue as I have been stuck for the last couple of days and I don't know what I'm doing wrong.

Thanks in advance
Luis
4 REPLIES 4

krull80
Champ in-the-making
Champ in-the-making
Just in case someone needs it, for Weblogic I solved some conflicts with the existing cxf by using <prefer-application-packages> in weblogic-application.xml.

In addition there could be some problems with cxf and STAX and security you could avoid by adding:

<code>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
  <property name="targetObject">
   <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetClass" value="java.lang.System" />
    <property name="targetMethod" value="getProperties" />
   </bean>
  </property>
  <property name="targetMethod" value="putAll" />
  <property name="arguments">
   <utilSmiley Tongueroperties>
    <prop key="org.apache.cxf.stax.allowInsecureParser">true</prop>
   </utilSmiley Tongueroperties>
  </property>
</bean>
</code>

cdeneux
Champ in-the-making
Champ in-the-making
Hi all,

I've got the same problem about the exception ClassCastException parsing my WSDL. The problem is due to the CxfWSDLImporter that supports only structure as message content. In your XSD you've declared the element SendPublicationRequest as string that is not a structure.

I've just created the associated JIRA issue: https://activiti.atlassian.net/browse/ACT-3999

Regards,
Christophe

cdeneux
Champ in-the-making
Champ in-the-making
A patch is available into the pull request https://github.com/Activiti/Activiti/pull/575

trademak
Star Contributor
Star Contributor
Thanks, I've applied the patch.

Best regards,
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.