Spring與Resin結(jié)合時(shí)解析XML配置文件問(wèn)題解決!
大多數(shù)朋友都會(huì)碰到當(dāng)在Resin下使用Spring2.0的時(shí)候會(huì)碰到一些解析Spring XML配置文件的問(wèn)題,通常最常碰到的是當(dāng)Spring使用AOP形式來(lái)托管事物的時(shí)候,如:
?<!– 事物管理配置 –>
![]()
![]()
?1? < aop:config? proxy-target-class =”true”>
?2????? <aop:advisor?pointcut =”execution(*? com.wayan..*Action.*(..))”?advice-ref =”txAdvice”/>???
?3? </aop:config >
?4?
?5? < tx:advice? id =”txAdvice”? transaction-manager =”txManager”>
?6????? <tx:attributes >
?7??????? < tx:method? name =”get*”? read-only =”true”/>
?8??????? <tx:method?name =”find*”? read-only =”true”/>
?9??????? <tx:method?name =”*”? />
10????? </ tx:attributes >
11? </ tx:advice >
就很容易引起XML文件解析不了,為了解決這類(lèi)問(wèn)題可以通過(guò)在resin.conf配置文件里加入如下兩行代碼,如:
![]()
![]()
1? < system-property? javax.xml.parsers.DocumentBuilderFactory =”org.apache.xerces.jaxp.DocumentBuilderFactoryImpl”/>
2? <system-property?javax.xml.parsers.SAXParserFactory =”org.apache.xerces.jaxp.SAXParserFactoryImpl”/>
強(qiáng)制Resin使用apache的XML解析器來(lái)解析,而不是Resin默認(rèn)的XML解析器來(lái)工作,不過(guò)這樣的話您需要將xerces.jar和xml-api.jar兩個(gè)文件放入您的工程下面才行!
作者:曹江華
網(wǎng)名:太陽(yáng)里的雪
電話:13590309275
QQ:83058327
MSN:ardenemily@msn.com
郵件:arden.emily@gmail.com
首發(fā):http://www.ugole.com
蛙眼:http://www.wayan.cn
滾吧:http://www.gunba.cn
真友:http://www.zhenuu.com
posted on 2007-03-21 16:16 太陽(yáng)里的雪 閱讀(2172) 評(píng)論(2) 編輯 收藏 所屬分類(lèi): Java