Tomcat6和7版本对web.xml中taglib标签的配置差异
原来部署在Tomcat6中的应用在Tomcat7中运行时报错如下错误:
java.lang.IllegalArgumentException: taglib definition not consistent with specification version 严重: Parse error in application web.xml file at jndi:/localhost/iot/WEB-INF/web.xml org.xml.sax.SAXParseException; systemId: jndi:/localhost/iot/WEB-INF/web.xml; lineNumber: 217; columnNumber: 10; Error at (217, 10) : taglib definition not consistent with specification version
经百度发现,Tomcat7中对Web应用web.xml中的taglib标签配置稍有不同,需要在taglib标签外添加“jsp-config”标签进行包裹才行。
TomcatV6中的配置:
<taglib> <taglib-uri>sys</taglib-uri> <taglib-location>/WEB-INF/SysTag.tld</taglib-location> </taglib> <taglib> <taglib-uri>tiles</taglib-uri> <taglib-location>/WEB-INF/tiles-jsp.tld</taglib-location> </taglib> <taglib> <taglib-uri>struts-tags</taglib-uri> <taglib-location>/WEB-INF/struts-tags.tld</taglib-location> </taglib>
TomcatV7中的配置:
<jsp-config> <taglib> <taglib-uri>sys</taglib-uri> <taglib-location>/WEB-INF/SysTag.tld</taglib-location> </taglib> <taglib> <taglib-uri>tiles</taglib-uri> <taglib-location>/WEB-INF/tiles-jsp.tld</taglib-location> </taglib> <taglib> <taglib-uri>struts-tags</taglib-uri> <taglib-location>/WEB-INF/struts-tags.tld</taglib-location> </taglib> </jsp-config>
更新配置后即可正常启动。