« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9699601 建立时间:2004年12月20日 |

| |
[j2ee]resin的xml问题 原创空间, 软件技术, 电脑与网络
邢红瑞 发表于 2007/4/12 19:12:51 |
为了和以前的项目版本一致,使用resin 3.0.25.当引用import javax.xml.parsers.SAXParser;import javax.xml.parsers.SAXParserFactory使用final SAXParser parser = SAXParserFactory.newInstance().newSAXParser();时,出现异常。主要是无法得知抛出那个异常
try { Xmlparse.parse(); } catch (Exception ex) { logger.warn("..."); }我使用他的jar文件,并且无法编译源码。只能一行一行猜,最终发现是xml解析器的问题,resin默认使用自己的xml解析器,这就让某些基于sun的jaxp的程序运行出现问题。
spring 2.x的xsd 配置 也是这个问题 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的默认解析器.
web-app标签中加入<system-propertyjavax.xml.parsers.DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/> <system-propertyjavax.xml.parsers.SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl" />就可以解决,3.1.6 已经解决这个bug。
最好
<web-app-default>
<system-property javax.xml.parsers.DocumentBuilderFactory= "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
<system-property javax.xml.parsers.SAXParserFactory= "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl" /> <!-- xslt -->
<system-property javax.xml.transform.TransformerFactory= "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"/>
server中加入
<server> <!-- xml -->
<system-property javax.xml.parsers.DocumentBuilderFactory= "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
<system-property javax.xml.parsers.SAXParserFactory= "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl" /> <!-- xslt -->
<system-property javax.xml.transform.TransformerFactory= "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"/>
</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"/>把xercesImpl.jar,xml-apis.jar,如果用到xslt,还需要xalan.jar 加入%RESIN_HOME%/lib 目录,加入到WEB-INF/lib有时候会有问题。 |
|
回复:为什么遇到bug的总是我 原创空间, 软件技术, 电脑与网络
真不准发表评论于2008/5/15 20:59:03 |
jsp文件后面敲入一个或者两个.. 在连续输入两次回车,就会看到源码,
~~~~~~~~~~~~~~~~~~~~~~
这是个老BUG了啊,
==================
Resin也提供了一个自己的standalone web server.当在这个Web Server下运 行时,如果在JSP文件名后添加"../",Resin ServletExec会泄漏JSP的源代码: 网管联盟bitsCN_com
http://benjurry/benjurry.jsp../ 【转自www.bitsCN.com】
|
|
» 1 »
|