[ https://issues.apache.org/jira/browse/CXF-8622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17455943#comment-17455943 ]
Ashish Singh commented on CXF-8622: ----------------------------------- We got is working by moving all the remotely dependent schema files in our project itself under webContent/cxf and moved those files along with some of the dependent schema files which are internally mentioned (for ex- in jaxrs.xsd, jaxws.xsd, jaxrs-client.xsd, there are internal dependencies of cxf-beans.xsd, jaxrs-common.xsd, parameterized-types.xsd). And in application-context.xml, we changes the remote dependecies to point to the above mentioned cxf directory. {color:#de350b}http://cxf.apache.org/schemas/jaxrs.xsd {color}was replaced with{color:#FF0000} {color}{color:#00875a}_cxf/jaxrs.xsd_{color} {color:#00875a}_{color:#de350b}http://cxf.apache.org/schemas/jaxws.xsd {color}was replaced with{color:#FF0000} {color}cxf/jaxws.xsd_ {color:#172b4d}and so on.{color}{color} > Issue with serving schema files over http > ----------------------------------------- > > Key: CXF-8622 > URL: https://issues.apache.org/jira/browse/CXF-8622 > Project: CXF > Issue Type: Bug > Reporter: Jeff > Priority: Major > > Hello, > We use spring framework libraries and they're utilizing sites on apache such > as: > [http://cxf.apache.org/schemas/jaxrs.xsd] > The error we currently get is the following: > {code} > 2021-12-03 16:54:51,760 ERROR - Context initialization failed > org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 > in XML document from ServletContext resource > [/WEB-INF/application-context.xml] is invalid; nested exception is > org.xml.sax.SAXParseException; systemId: > http://cxf.apache.org/schemas/jaxrs.xsd; lineNumber: 1; columnNumber: 1; > Premature end of file. > at > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399) > at > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) > {code} > We believe this is due to the fact that http isn't serving the schema file. > We had this working yesterday so believe that something may have changed > recently around this. A similar bug that we found I believe is here: > https://issues.apache.org/jira/browse/CAMEL-13890 > We tried internally referencing the https location. e.g. > [https://cxf.apache.org/schemas/jaxrs.xsd] but then we get a schema doesn't > match error. > {code} > Caused by: org.xml.sax.SAXParseException; systemId: > https://cxf.apache.org/schemas/jaxrs.xsd; lineNumber: 28; columnNumber: 40; > TargetNamespace.1: Expecting namespace 'https://cxf.apache.org/jaxrs', but > the target namespace of the schema document is 'http://cxf.apache.org/jaxrs'. > at > com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) > at > com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) > at > com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) > {code} > Also when we do curl here vs doing curl in https the body is different as > expected: > {code:java} > platform % curl -vvv http://cxf.apache.org/schemas/jaxrs.xsd > * Trying 151.101.2.132... > * TCP_NODELAY set > * Connected to cxf.apache.org (151.101.2.132) port 80 (#0) > > GET /schemas/jaxrs.xsd HTTP/1.1 > > Host: cxf.apache.org > > User-Agent: curl/7.64.1 > > Accept: */* > > > < HTTP/1.1 301 Moved Permanently > < Server: Varnish > < Retry-After: 0 > < Location: https://cxf.apache.org/schemas/jaxrs.xsd > < Content-Length: 0 > < Accept-Ranges: bytes > < Date: Sat, 04 Dec 2021 01:28:38 GMT > < Via: 1.1 varnish > < Connection: close > < X-Served-By: cache-bos4646-BOS > < X-Cache: HIT > < X-Cache-Hits: 0 > < X-Timer: S1638581319.719643,VS0,VE0 > < Strict-Transport-Security: max-age=300 > < > * Closing connection 0{code} > Here's an example of the application-context.xml file that we have where > springframework.org files serve fine over http > {code} > <beans xmlns:context="http://www.springframework.org/schema/context" > xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:jaxrs="http://cxf.apache.org/jaxrs" > xmlns:jaxws="http://cxf.apache.org/jaxws" > xsi:schemaLocation="http://www.springframework.org/schema/beans > > http://www.springframework.org/schema/beans/spring-beans.xsd > http://www.springframework.org/schema/context > > http://www.springframework.org/schema/context/spring-context.xsd > http://cxf.apache.org/jaxrs > http://cxf.apache.org/schemas/jaxrs.xsd > http://cxf.apache.org/jaxws > http://cxf.apache.org/schemas/jaxws.xsd"> > {code} > Any help around this is greatly appreciated, thanks! -- This message was sent by Atlassian Jira (v8.20.1#820001)