简而言之,我正在努力学习一点Spring。问题是,当我部署我的应用程序时,Spring加载XML文件并遇到此异常:
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)
....
我发现这是由W3返回503导致重复下载其DTD文件的请求引起的(有关详细信息,请参阅here)。有没有办法让Spring使用缓存版本?另外,我该怎么做呢?我的环境包括Glassfish v3,Spring v2.5.6,Spring Web Flow v2.0.8和NetBeans 6.8
事情是,文件中没有提到DTD。这是我spring-servlet.xml
的样子:
<?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">
....
</beans>
干杯
答案 0 :(得分:2)
你的spring xml文件不应该是XHTML,所以只需删除DTD声明即可。 相反,使用xml架构,如
中的示例所示答案 1 :(得分:0)
W3服务器可能已关闭...但是对于一个应用程序停止工作而言它并不酷,它无法与w3.org交谈,并且w3.org对于重新获取标准DTD等的应用程序并不友好它运行的时间。
您的应用程序应该拥有自己的标准DTD永久存储库,并且应该进行配置,以便XML解析器等首先知道它们。或者,您应该安排您的代理人拥有相关DTD的永久副本。
无论如何,正如@ andi5所说,Spring接线文件不应该使用那个特定的DTD。因此,删除引用应修复此问题的特定实例。