jsp页面中struts2的标签,不能解析,出错
在自己做的struts2的小例子里面,jsp页面的struts2标签不能解析出来,页面只要有引入struts2标签的那句,就出错。
查了一下,多半说是jar包没引入的,我也看了我的jar包,觉得好像没缺少哪个。
jar包:struts2-core-2.0.11 xwork ognl freemaker common-logging-1.0.4 common-fileupload
页面是500的错
exception
javax.servlet.ServletException: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:273)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
root cause
java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
org.apache.jasper.compiler.TagLibraryInfoImpl.createAttribute(TagLibraryInfoImpl.java:581)
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:402)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:249)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:180)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:424)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:493)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1557)
org.apache.jasper.compiler.Parser.parse(Parser.java:127)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.26 logs.
请高手们帮忙看一下,纠结了两天了
------解决方案--------------------把asm的三个jar包都导入 其实还是你包没导全。
------解决方案--------------------java.lang.
NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
org.apache.jasper.compiler.TagLibraryInfoImpl.createAttribute(TagLibraryInfoImpl.java:568)
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:401)
“导致以上原因的是因为javax.servlet.jsp.tagext.TagAttributeInfo有冲突
当前classpath中有两个version的javax.servlet.jsp.tagext.TagAttributeInfo class,一个在javax.servlet.jar另一个在jsp-api.jar中。 jsp-api.jar的那个是好用的,它只包含javax\servlet\jsp这个包,而servlet.jar中也包含它,同时包含servlet需要的关键包。所以在classpath中jsp-api.jar要比servlet.jar先被reference。”
但还是无济于事。最终将CATALINA_HOME\common\lib下的javax.servlet.jar删除,一切OK!