当Spring试图加载XML文件时,防止W3.org发现503错误
问题描述:
简而言之,我想学习一点Spring。问题是,当我部署我的应用程序,春加载XML文件并遇到此异常:当Spring试图加载XML文件时,防止W3.org发现503错误
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引起谁的重复请求下载他们的DTD文件返回503(见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>
干杯
答
你的Spring XML文件不应该是XHTML,所以只是删除DTD声明。 相反,使用XML模式,如显示的例子在
答
W3的服务器可能是下跌...但它是不冷静的应用程序停止工作不能跟W3.org网站,对于应用程序每次运行时重新读取标准的DTD等,它对w3.org不友好。
您的应用程序应该有自己的标准DTD etetera的永久存储,并且应该进行配置,以便XML解析器等知道首先在那里查找。或者,您应该安排您的代理人拥有相关DTD的永久副本。
无论如何,正如@andi5所说,弹簧布线文件不应该使用该特定的DTD。因此,删除参考应该解决这个问题的特定实例。
是的,事情是DTD没有提到那里 – Sevas 2010-02-15 22:58:18
间接,它是。只需加上-1.0即可阅读http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd。您所指的模式文件是一个XHTML文档。 – andi5 2010-02-16 17:36:34