You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2009/12/07 22:42:18 UTC

[jira] Commented: (CXF-2571) wsdl2java and jax-ws-catalog: failing to resolve schemas included with xsd:include in jar-file

    [ https://issues.apache.org/jira/browse/CXF-2571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787133#action_12787133 ] 

Daniel Kulp commented on CXF-2571:
----------------------------------


I got past the NPE in 2.2.5 (we were not setting the systemId), but ran into a bug in XJC.   They are doing:

new URI(locator.getSystemId()).resolve(new URI(schemaLocation))

to resolve the include.   However, that doesn't work with a "jar" url as the systemId of the original schema.   The URI in that case is considered opaque and thus resolve just returns the child value as is.       I THINK I can work around this by kind of DOM loading the schemas and preprocessing the includes and such, but yuck.   

I'm going to doubt I'll be able to fix this on 2.1.x as the databinding/schema code there is very  different.


> wsdl2java and jax-ws-catalog: failing to resolve schemas included with xsd:include in jar-file
> ----------------------------------------------------------------------------------------------
>
>                 Key: CXF-2571
>                 URL: https://issues.apache.org/jira/browse/CXF-2571
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.1.8, 2.2.5
>         Environment: Apache Maven 2.2.1
> Java version: 1.5.0_21
> OS name: "windows xp"
>            Reporter: HÃ¥kan Dahl
>         Attachments: jax-ws-catalog-test-20091203.zip
>
>
> cxf-codegen-plugin/wsdl2java (2.1.8, 2.2.5)
> Refer user-list thread:
> http://old.nabble.com/jax-ws-catalog-and-resolving-schemas-in-jars-that-do-xsd%3Ainclude-td26590812.html
> Schema resolution from a jar-file (using jax-ws-catalog as per 4.4 Catalog Facility in the JAX-WS 2.1 spec) fails when:
> * The referenced schema in a jar makes xsd:include on another schema in the
> jar (all schemas in a jar share the same namespace).
> Stacktrace below for CXF 2.1.8 below. CXF 2.2.5 also fails but with a NullPointerException.
> Note: xsd:import works but requires imported schema to be in another
> namespace.
> Projects look like:
> common-types-domain1
>    META-INF/jax-ws-catalog.xml
>    schemas/domain1/domain1-schema1.xsd
>    schemas/domain1/domain1-schema2.xsd
> wsdl-project-1
>    src\main\resources\schemas\GetX.xsd
>    src\main\resources\schemas\GetXService.wsdl
> where the GetXService.wsdl imports GetX.xsd which imports
> domain1-schema2.xsd like this:
> GetX.xsd:
>    <xsd:import namespace="http://www.example.org/schemas/domain1"
>        schemaLocation="
> http://www.example.org/schemas/domain1/domain1-schema2.xsd"/>
> domain1-schema2.xsd:
>    <xsd:include schemaLocation="domain1-schema1.xsd"/>
> common-types-domain1/META-INF/jax-ws-catalog.xml:
>    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
> prefer="system">
>      <system systemId="
> http://www.example.org/schemas/domain1/domain1-schema1.xsd"
>          uri="classpath:schemas/domain1/domain1-schema1.xsd"/>
>      <system systemId="
> http://www.example.org/schemas/domain1/domain1-schema2.xsd"
>          uri="classpath:schemas/domain1/domain1-schema2.xsd"/>
>    </catalog>
> results in:
> Caused by: org.apache.cxf.tools.common.ToolException: Thrown by JAXB :
> http://www.example.org/schemas/domain1/domain1-schema1.xsd
>    at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBBindErrorListener.error(JAXBBindErrorListener.java:34)
>    at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.error(SchemaCompilerImpl.java:285)
>    at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:90)
>    at
> com.sun.tools.xjc.reader.internalizer.DOMForest.parse(DOMForest.java:402)
>    at
> com.sun.tools.xjc.reader.internalizer.DOMForest.parse(DOMForest.java:301)
>    at
> com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl.startElement(AbstractReferenceFinderImpl.java:95)
>    at
> org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
>    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:240)
>    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277)
>    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246)
>    at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123)
>    at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.parseSchema(SchemaCompilerImpl.java:135)
>    at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.addSchemas(JAXBDataBinding.java:253)
>    at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:196)
>    at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:588)
>    at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:239)
>    at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:130)
>    at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:283)
>    at
> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:83)
>    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:103)
>    at
> org.apache.cxf.maven_plugin.WSDL2JavaMojo.processWsdl(WSDL2JavaMojo.java:337)
>    ... 20 more
> Caused by: java.io.FileNotFoundException:
> http://www.example.org/schemas/domain1/domain1-schema1.xsd
>    ... 39 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.