lizongbo at 618119.com 工作,生活,Android,前端,Linode,Ubuntu,nginx,java,apache,tomcat,Resin,mina,Hessian,XMPP,RPC

2008年12月29日

jsper编译遇到”SEVERE: Invalid PUBLIC ID”的解决办法

Filed under: Tomcat — 标签:, , — lizongbo @ 13:36
用到了自定义标签,且tld声明为:
<?xml version=”1.0″ encoding=”ISO-8859-1″ ?>
<!DOCTYPE taglib
PUBLIC “-//Sun Microsystems, Inc.//
JSP Tag Library 1.1//EN”
http://java.sun.com/j2ee/dtds/
web-jsptaglibrary_1_1.dtd”>
结果使用tomcat预编译时出错,出错信息:
jspc:
[] Dec 16, 2008 8:24:41 PM org.apache..xmlparser.MyEntityResolver resolveEntity
[jasper] SEVERE: Invalid PUBLIC ID: -//Sun Microsystems, Inc.// DTD JSP Tag Library 1.1//EN
BUILD FAILED
/usr/local/build_file/build_webapp.xml:121: org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/tlds/lizongbo.tld
Total time: 6 seconds
经查tomcat的jsper代码,找到org.apache.jasper.xmlparser.ParserUtils
发现对没有缓存的dtd采取的是访问url进行下载方式检查,
已经缓存的dtd在org.apache.jasper.Constants 中有定义
public static final String TAGLIB_DTD_PUBLIC_ID_11 =
“-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN”;
于是修改dtd定义为:
<?xml version=”1.0″ encoding=”ISO-8859-1″ ?>
<!DOCTYPE taglib
PUBLIC ” “-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN”
http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd“>
重新编译通过。

没有评论 »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress