Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2708

endpoint validation fails if WSDL referenced schemas exist on classpath outside the jar the endpoint exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.6, 2.2.7
    • 2.2.7
    • None
    • None

    Description

      Assuming you have split out XSDs into their own project, and you have an endpoint configured like so:

              <jaxws:properties>
                  <entry key="schema-validation-enabled"
                         value="true"/>
              </jaxws:properties>
      

      What happens is, if you send a request to your endpoint it can't find the referenced XSDs.

      The error message I get differs on whether I use 2.2.6 or 2.2.7-SNAPSHOT. I'm not sure if they both represent the same problem. In 2.2.6, the problem states that the WSDL had a "premature end of file", but when I debugged I found it was simply the fact the schemas it references could not be found:

      2.2.6 error
      Mar 11, 2010 2:05:06 PM org.apache.cxf.wsdl.EndpointReferenceUtils createSchema
      WARNING: SAXException for newSchema() on 
      Throwable occurred: org.xml.sax.SAXParseException: Premature end of file.
              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:231)
              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:210)
              at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:424)
              at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1425)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1073)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:662)
              at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:154)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:525)
              at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:471)
              at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:527)
              at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:546)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:1838)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:1793)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:1022)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:605)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:588)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:555)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:521)
              at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:246)
              at org.apache.cxf.wsdl.EndpointReferenceUtils.createSchema(EndpointReferenceUtils.java:666)
              at org.apache.cxf.wsdl.EndpointReferenceUtils.getSchema(EndpointReferenceUtils.java:690)
              at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.setSchemaInMessage(AbstractInDatabindingInterceptor.java:109)
              at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.getDataReader(AbstractInDatabindingInterceptor.java:94)
              at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.getDataReader(AbstractInDatabindingInterceptor.java:99)
              at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:66)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
              at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
              at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:406)
              at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
              at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
              at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
              at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
              at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
              at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
              at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
              at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
              at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
              at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
              at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
              at org.mortbay.jetty.Server.handle(Server.java:326)
              at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
              at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
              at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
              at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
              at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
              at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
              at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
      

      In 2.2.7-SNAPSHOT it actually lists the schemas it could not resolve, and gives another message stating "this schema contains two occurrences of 'urn:hl7-org:v3,FICR_IN100204CA'.":

      2.2.7-SNAPSHOT error
      [INFO] Starting scanner at interval of 5 seconds.
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT050207CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT050201CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT260022CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for FICR_MT600601CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for MCAI_MT700211CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for FICR_MT600401CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for FICR_MT510401CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT290000CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT490000CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT600000CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT280002CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT290000CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT490000CA.xsd
      Mar 11, 2010 2:16:34 PM org.apache.cxf.wsdl.EndpointReferenceUtils$SchemaLSResourceResolver resolveResource
      WARNING: Could not resolve Schema for COCT_MT680000CA.xsd
      WARNING: SAXException for newSchema() on 
      Throwable occurred: org.xml.sax.SAXParseException: sch-props-correct.2: A schema cannot contain two global components with the same name; this schema contains two occurrences of 'urn:hl7-org:v3,FICR_IN100204CA'.
              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:231)
              at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:167)
              at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:420)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2573)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2564)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.checkForDuplicateNames(XSDHandler.java:2238)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.buildGlobalNameRegistries(XSDHandler.java:1191)
              at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:611)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:588)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:555)
              at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:521)
              at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:246)
              at org.apache.cxf.wsdl.EndpointReferenceUtils.createSchema(EndpointReferenceUtils.java:669)
              at org.apache.cxf.wsdl.EndpointReferenceUtils.getSchema(EndpointReferenceUtils.java:693)
              at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.setSchemaInMessage(AbstractInDatabindingInterceptor.java:109)
              at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.getDataReader(AbstractInDatabindingInterceptor.java:94)
              at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.getDataReader(AbstractInDatabindingInterceptor.java:99)
              at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:66)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
              at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
              at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
              at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
              at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
              at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
              at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
              at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
              at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
              at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
              at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
              at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
              at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
              at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
              at org.mortbay.jetty.Server.handle(Server.java:326)
              at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
              at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
              at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
              at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
              at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
              at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
              at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
      
      

      I've tried several things, including catalog files, but I can't resolve this. It seems to be the underlying schema parsers themselves that have the issue. Spent a few days trying to debug far enough into the issue to formulate that opinion, so unfortunately I have no patch to contribute.

      To replicate:
      1. Unzip the attached project
      2. Change directory to CXFSchemaRefProblemPom
      3. edit pom.xml to switch to the appropriate version of cxf and cxf-codegen (2.2.6 or 2.2.7-SNAPSHOT (which is the one the project is currently set for))
      4. switch to CXFSchemaRefProblemWar and execute mvn jetty:run
      5. switch to the parent directory where sample-req.xml exists and send a request to the endpoint: curl -d @sample-req.xml -H "Content-Type: text/xml;charset=UTF-8" http://localhost:8080/ProcessClaim

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            ctataryn Craig Tataryn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: