[
https://issues.apache.org/activemq/browse/CAMEL-2449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vincent Girard-Reydet updated CAMEL-2449:
-----------------------------------------
Attachment: upload.zip
A minimum test case to reproduce the problem
> Schema files relative to WSDL file break CxfEndpoint
> ----------------------------------------------------
>
> Key: CAMEL-2449
> URL: https://issues.apache.org/activemq/browse/CAMEL-2449
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-cxf
> Affects Versions: 2.1.0
> Environment: ServiceMix 4.1.0 SNAPSHOT (head:904129), without the JBI
> components
> Camel 2.1.0 with CXF 2.2.5
> Sun JDK 1.6.17
> Windows XP SP3
> Reporter: Vincent Girard-Reydet
> Attachments: upload.zip
>
>
> I have a WSDL (see files attached) that imports a schema file. I create a
> Camel-CXF route from a SOAP endpoint to a logger :
> <c:camelContext>
> <c:route>
> <c:from uri="cxf:bean:alarmServiceEndpoint2"/>
> <c:to uri="log:test"/>
> </c:route>
> </c:camelContext>
> There are 2 problems:
> 1. If the XSD is imported like this (without "./" in schemaLocation):
> <xs:schema xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://diva.thales/xsd"
> schemaLocation="AlarmServices.xsd"/>
> </xs:schema>
> then it is possible to create a CXF Endpoint using an implementation class
> (see files attached, the Test class is an implementation os the AlarmServices
> SEI):
> <cxf:cxfEndpoint id="alarmServiceEndpoint2"
> address="/AlarmServices2"
> serviceClass="eu.diva.tis.alert.internal.Test"
> endpointName="alarm:AlarmServicesSOAP12port_http"
> serviceName="alarm:AlarmServices"
> xmlns:alarm="http://diva.thales"/>
> but if I use the Service Provider API it will fail:
> <cxf:cxfEndpoint id="alarmServiceEndpoint"
> address="/AlarmServices"
> serviceClass="com.thales.diva.AlarmServicesProvider"
> endpointName="alarm:AlarmServicesSOAP12port_http"
> serviceName="alarm:AlarmServices"
> wsdlURL="classpath:/diva/schemas/AlarmServices.wsdl"
> xmlns:alarm="http://diva.thales" />
> with the following exception:
> Exception in thread "SpringOsgiExtenderThread-56"
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToStartRouteException:
> org.apache.cxf.service.factory.ServiceConstructionException: Failed to create
> service.
> at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1039)
> at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
> ...
> Caused by: javax.wsdl.WSDLException: WSDLException (at
> /wsdl:definitions/wsdl:types/xs:schema): faultCode=PARSER_ERROR: Problem
> parsing 'AlarmServices.xsd'.: java.io.FileNotFoundException:
> D:\smx4\build2\AlarmServices.xsd (The specified file cannot be found)
> at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
> at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
> at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
> at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
> at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
> at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
> at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
> at
> org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:229)
> at
> org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
> at
> org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
> ... 28 more
> 2. Now if I change my WSDL to use a relative location for the XSD import:
> <xs:schema xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://diva.thales/xsd"
> schemaLocation="./AlarmServices.xsd"/>
> </xs:schema>
> In *both* cases, I get the following, very strange error:
> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
> route route10: Route[[From[cxf:bean:alarmServiceEndpoint2]] ->
> [To[log:test... because of Failed to resolve endpoint:
> cxf://bean:alarmServiceEndpoint2 due to:
> org.apache.camel.spring.SpringCamelContext cannot be cast to
> org.apache.camel.spring.SpringCamelContext
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:141)
> at
> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:601)
> at
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1156)
> at
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1073)
> ...
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve
> endpoint: cxf://bean:alarmServiceEndpoint2 due to:
> org.apache.camel.spring.SpringCamelContext cannot be cast to
> org.apache.camel.spring.SpringCamelContext
> at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:437)
> at
> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:46)
> ...
> Caused by: java.lang.ClassCastException:
> org.apache.camel.spring.SpringCamelContext cannot be cast t
> o org.apache.camel.spring.SpringCamelContext
> at
> org.apache.camel.component.cxf.CxfSpringEndpoint.init(CxfSpringEndpoint.java:68)
> at
> org.apache.camel.component.cxf.CxfSpringEndpoint.<init>(CxfSpringEndpoint.java:61)
> at
> org.apache.camel.component.cxf.CxfComponent.createEndpoint(CxfComponent.java:63)
> at
> org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:78)
> ...
> Using a debugger I checked in the CxfSpringEndpoint init() method that the
> CamelContext instance retrieved is really a SpringCamelContext. In the
> Manifest.MF of my bundle I have imported nearly all Camel packages (including
> org.apache.camel.spring) but it does not change anything.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.