tags:

views:

295

answers:

2

In short, I'm trying to learn a bit of Spring. Problem is, when I deploy my application, Spring loads XML files and encounters this exception:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 8 in XML document from ServletContext resource [/WEB-INF/spring-servlet.xml] is invalid;
nested exception is oracle.xml.parser.schema.XSDException:
Server returned HTTP response code: 503 for URL:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
....

I found that this is caused by W3 who return a 503 for recurring requests to download their DTD files (see here for details). Is there any way to get Spring to use a cached version? Also, how would I go about doing that? My environment includes Glassfish v3, Spring v2.5.6, Spring Web Flow v2.0.8 and NetBeans 6.8

Thing is, the DTD is not mentioned in the file. Here's what my spring-servlet.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:webflow="http://www.springframework.org/schema/webflow-config"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/webflow-config
   http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd"&gt;
....
</beans>

Cheers

+2  A: 

Your spring xml file should not be XHTML, so just remove the DTD declaration. Instead, use xml schemas, as showed in the example at

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-factory-metadata

Yeah, thing is the DTD is not mentioned there
Sevas
Indirectly, it is. Just add -1.0 to make it read http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd. The schema file you are referring to is an XHTML document.
A: 

The W3 server was probably down ... but it is not cool for an application to stop working it cannot talk to w3.org, and it is not friendly to w3.org for an application to refetch standard DTDs, etc each time it runs.

Your application should have its own permanent store of standard DTDs etetera, and should be configured so that XML parsers and the like know to look there first. Alternatively, you should arrange that you proxy has permanent copies of the relevant DTDs.

Anyway as @andi5 says, a Spring wiring file should not be using that particular DTD anyway. So removing the reference should fix this particular instance of the problem.

Stephen C