views:

379

answers:

1

I have a web app running on a production server which does not allow public internet access. The initialization fails with error like

2010-02-18 15:21:33,150 **WARN**  [SimpleSaxErrorHandler.java:47] Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'https://jax-ws.dev.java.net/spring/servlet.xsd', because 1) could not find the document; 2) the document could not be
 read; 3) the root element of the document is not <xsd:schema>.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
 ...

2010-02-18 15:21:33,154 **ERROR** [ContextLoader.java:215] Context initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from ServletContext resource [/WEB-INF/app.xml] is invalid; nested exception is org.xml.sax.SAXPar
seException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'wss:binding'.
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:389)

It seems the 1st WARN indicates the app failed to download the schema file, which caused the 2nd ERROR.

My questions are:

  1. I feel it is reasonable that I should be able to run an app w/o having to have internet access. how can I ask the xml parser to use a local schema file instead of a copy downloaded from the internet. I know XML catalog has the capability. I am using tomcat and spring. Is there a way to configure XML catalog? Are there other mechanisms that can achieve the same purpose?

  2. If I cannot redirect the parser to use a local schema file. Can I disable the xml schema validation? Again, I would like to just configure the behavior without touching the code.

A: 

Put the schemas you need in your classpath, and then use a resolver to use it.

bmargulies