2010-02-13 24 views
0

簡而言之,我想學習一點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> 

乾杯

回答

2

你的Spring XML文件不應該是XHTML,所以只是刪除DTD聲明。 相反,使用XML模式,如顯示的例子在

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

+0

是的,事情是DTD沒有提到那裏 – Sevas 2010-02-15 22:58:18

+0

間接,它是。只需加上-1.0即可閱讀http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd。您所指的模式文件是一個XHTML文檔。 – andi5 2010-02-16 17:36:34

0

W3的服務器可能是下跌...但它是不冷靜的應用程序停止工作不能跟W3.org網站,對於應用程序每次運行時重新讀取標準的DTD等,它對w3.org不友好。

您的應用程序應該有自己的標準DTD etetera的永久存儲,並且應該進行配置,以便XML解析器等知道首先在那裏查找。或者,您應該安排您的代理人擁有相關DTD的永久副本。

無論如何,正如@andi5所說,彈簧佈線文件不應該使用該特定的DTD。因此,刪除參考應該解決這個問題的特定實例。

相關問題