Uploaded image for project: 'ODE'
  1. ODE
  2. ODE-241

An xsd including another xsd throws a NPE on deployment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1.1
    • 1.2
    • Axis2 Integration
    • None

    Description

      There's a ws-commons XmlSchema bug giving us some problems with some relative XSD includes, the original stack is reproduced below. The situation is basically:

      WSDL -> XSD1 -> XSD2

      The baseUri we get from the SchemaBuilder to resolve XSD2 is wrong as it's resolved relatively to the WSDL instead of XSD1. I wish it was simple to fix but actually it's not as it's more of a design issue in XmlSchema. All imports within a WSDL document (including transitive ones like we have here) are associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection.

      I filed a WS-COMMONS bug for this but as you can see they don't seem to get the problem: https://issues.apache.org/jira/browse/WSCOMMONS-265

      15:20:11,083 DEBUG [ODEAxisService] resolveEntity: targetNamespace=http://www.agora.msa.fr/TarifMaladie schemaLocation=../XSDSchema/MatricePriseEnCharge.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
      DEBUG - GeronimoLog.debug(66) | resolveEntity: targetNamespace=http://www.agora.msa.fr/TarifMaladie schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
      15:20:11,088 DEBUG [ODEAxisService] resolveEntity: targetNamespace=http://www.agora.msa.fr/TarifMaladie schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
      ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl
      java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(FileInputStream.java:106)
      at java.io.FileInputStream.<init>(FileInputStream.java:66)
      at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
      at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
      at java.net.URL.openStream(URL.java:1007)
      at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41)
      at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872)
      at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
      at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
      at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
      at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
      at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
      at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
      at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884)
      at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902)
      at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674)
      at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169)
      at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
      at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
      at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.copyExtensibleElements(WSDL11ToAxisServiceBuilder.java:2186)
      at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:306)
      at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:297)
      at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:265)
      at org.apache.ode.axis2.hooks.ODEAxisService.createService(ODEAxisService.java:79)
      at org.apache.ode.axis2.ODEServer.createService(ODEServer.java:299)
      at org.apache.ode.axis2.BindingContextImpl.activateMyRoleEndpoint(BindingContextImpl.java:59)
      [ Show ยป ]
      Matthieu Riou - 17/Oct/07 04:19 PM This is unfortunately a ws-commons XmlSchema bug, the original stack is reproduced below. The situation is basically: WSDL -> XSD1 -> XSD2 The baseUri we get from the SchemaBuilder to resolve XSD2 is wrong as it's resolved relatively to the WSDL instead of XSD1. I wish it was simple to fix but actually it's not as it's more of a design issue in XmlSchema. All imports within a WSDL document (including transitive ones like we have here) are associated to a single XmlSchemaCollection. And the baseUri used for all resolving is the one of the collection. They should either have a collection per document or associate a baseUri with the document instead of the collection. I'm going to file a bug for XmlSchema for now. Apparently it's only been reported by one person in the community and there's a workaround. If a customer have the same problem or if more people run into it, we might have to consider fixing it ourselves. 15:20:11,083 DEBUG [ODEAxisService] resolveEntity: targetNamespace=http://www.agora.msa.fr/TarifMaladie schemaLocation=../XSDSchema/MatricePriseEnCharge.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl DEBUG - GeronimoLog.debug(66) | resolveEntity: targetNamespace=http://www.agora.msa.fr/TarifMaladie schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl 15:20:11,088 DEBUG [ODEAxisService] resolveEntity: targetNamespace=http://www.agora.msa.fr/TarifMaladie schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl ERROR - GeronimoLog.error(108) | Exception resolving entity: schemaLocation=ListeProduit.xsd baseUri=file:/home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/NewDiagram2-Pool0.wsdl java.io.FileNotFoundException: /home/mriou/dev/tools/platform/apache-tomcat-5.5.23/webapps/ode/WEB-INF/processes/TestXSD/BPMN/ListeProduit.xsd (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) at java.net.URL.openStream(URL.java:1007) at org.apache.ode.axis2.util.Axis2UriResolver.resolveEntity(Axis2UriResolver.java:41) at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1872) at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902) at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674) at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169) at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82) at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359) at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304) at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1884) at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1902) at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1674) at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:169) at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347) at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.copyExtensibleElements(WSDL11ToAxisServiceBuilder.java:2186) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:306) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:297) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:265) at org.apache.ode.axis2.hooks.ODEAxisService.createService(ODEAxisService.java:79) at org.apache.ode.axis2.ODEServer.createService(ODEServer.java:299) at org.apache.ode.axis2.BindingContextImpl.activateMyRoleEndpoint(BindingContextImpl.java:59)

      Attachments

        Issue Links

          Activity

            People

              mriou Matthieu Riou
              mriou Matthieu Riou
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: