Posted on 2007-01-03 17:53
Dr.Water 閱讀(1482)
評論(1) 編輯 收藏 所屬分類:
Java 隨手貼
Spring 官方已經提到這個錯誤了
http://www.springframework.org/docs/reference/xsd-config.html#xsd-config-integration-resin
A.3.3.1. XML parsing errors in the Resin v.3 application server
If you are using the XSD-style for Spring 2.0 XML configuration and deploying to v.3 of Caucho's Resin application server, you will need to set some configuration options prior to startup so that an XSD-aware parser is available to Spring.
Please do read this resource
而resin給出來的參考就是他默認不是使用xerces和xalan作為xml和xslt的默認解析器
正是由于他默認不是采用以上作為xml,xstl的解析器,導致了在resin下面 使用spring 2.0 新xsd配置方式會報錯誤
(主要就是xml中的attribute和propertie 他取不到)
解決的方法就是讓resin使用xerces和xalan作為xml和xslt的默認解析器
配置:
在resin.conf的<web-app>或者<server>節點下添加
<!-- xml -->
<system-property javax.xml.parsers.DocumentBuilderFactory=
???????????? "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
<system-property javax.xml.parsers.SAXParserFactory=
???????????? "org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
??
??? <!--? xslt -->
<system-property javax.xml.transform.TransformerFactory=
???????????? "org.apache.xalan.processor.TransformerFactoryImpl"/>
然后把相應的jar加入%RESIN_HOME%/lib 目錄,這里需要說明的是我在測試activemq的時候
加入xerces和xalan后,他包其他class無法找到,感覺好像是默認的web-app目錄下的jar無效了,我暫時直接加入系統classpath解決的
這點不知道是不是我自己的平臺問題。
經過測試 resin 3.0.22+spring 2.0+activemq xsd配置方式ok了,
ps. ^.^ 以前的resin下面項目沒有用2.0配置,自己也學習到了新東西