本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
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有时候会有问题。


阅读全文(3529) | 回复(2) | 编辑 | 精华
 


回复:为什么遇到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 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.063 second(s), page refreshed 144790405 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号