JAX-WS schema http://jax-ws.dev.java.net/spring/servlet.xsd could not be found
I am implementing JAX-WS with Spring framework.
Below is my Spring applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://jax-ws.dev.java.net/spring/core
http://jax-ws.dev.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet
http://jax-ws.dev.java.net/spring/servlet.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">
However, Eclipse complains:
The linked file contains errors ( http://jax-ws.dev.java.net/spring/servlet.xsd ).
After investigating, I find the url: http://jax-ws.dev.java.net/spring/servlet.xsd Doesn't exist. Instead, it looks like you need to navigate to: http://jax-ws.java.net/spring/servlet.xsd (You can open this link in a browser)
So I updated the XSD schema url from http://jax-ws.dev.java.net/spring/servlet.xsd to http://jax-ws.java.net/spring/servlet.xsd
Now my applicationContext.xml looks like this:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://jax-ws.dev.java.net/spring/core
http://jax-ws.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet
http://jax-ws.java.net/spring/servlet.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">
Actually with this change the Eclipse error disappears. The problem is that after starting the web service in Tomcat 7, I get the following runtime error:
org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 29; schema_reference.4: Failed to read schema document http://jax-ws.java.net/spring/servlet.xsd 'because 1) could not find the document; 2) the document cannot be read; 3) the root element of the document is missing. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (ErrorHandlerWrapper.java:198) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning (ErrorHandlerWrapper.java:99) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:433)
Please advise.
Many thanks. Respectfully,
Your problem is that you are changing the location from http://jax-ws.dev.java.net/spring/servlet.xsd to http://jax-ws.java.net/spring/servlet.xsd . Even though the latter is the correct url, it does not match what is defined in your jaxws-spring.jar META-INF / spring.schema file. This file should have the following content
http\://jax-ws.dev.java.net/spring/core.xsd=spring-jax-ws-core.xsd
http\://jax-ws.dev.java.net/spring/servlet.xsd=spring-jax-ws-servlet.xsd
http\://jax-ws.dev.java.net/spring/local-transport.xsd=spring-jax-ws-local-transport.xsd
Spring uses this mapping to find the schema on the classpath, not the internet. These schema files are located at the root of the jaxws-spring.jar file.
Please see Handler Registration and Schema
Are you using spring in your project? I had the same problem, but when I included spring-jaxws in my maven dependencies the problem was solved, in fact, you can see in this jar that the META-INF / spring.schemas file overrides the XSD locations
Perhaps this is not your case. But in a scenario like this, clean up and rebuild. The reason is that the old spring jar and the xsd from there will be accepted if two jars come out. Hope this helps other guys ... in general this exception will be thrown for many reasons.
Resources moved, final configuration should be:
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://jax-ws.dev.java.net/spring/core
http://jax-ws.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet
http://jax-ws.java.net/spring/servlet.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"
default-lazy-init="true">