org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo cl

exception

org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.html.MessagesTei
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:564)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:319)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

 

root cause

org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.html.MessagesTei
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:279)
	org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:418)
	org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:249)
	org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:162)
	org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
	org.apache.jasper.compiler.Parser.parseDirective(Parser.java:474)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1424)
	org.apache.jasper.compiler.Parser.parse(Parser.java:131)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:305)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:272)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:313)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:319)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

 

root cause

java.lang.ClassNotFoundException: org.apache.struts.taglib.html.MessagesTei
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1200)
	org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:415)
	org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:249)
	org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:162)
	org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
	org.apache.jasper.compiler.Parser.parseDirective(Parser.java:474)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1424)
	org.apache.jasper.compiler.Parser.parse(Parser.java:131)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:305)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:272)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:313)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:319)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)





 
这个问题困扰了我很长时间,上网搜了一下,很多人说将“WEB-INF/lib”下的struts.jar和servlet.jar删掉,我试了一下,没用。
看了一个老外的帖子,三个方法对我也没用,这里贴出来,可能对其他童鞋有帮助:
I figuered out solution to this problem yesterday. This problem can occur because of 3 things.... 1)Your struts jar files are missing in the WEB-INF/lib directory
2) The message resources config i.e. of your ApplicationResources.properties is written incorrectly in the struts-config.xml. if your file ApplicationResources.properties is under classes folder, then struts-config.xml should contain following entry.... <!-- Message Resources Configuration --> <message-resources parameter="ApplicationResources"/>
3) This is most important reason why application failed on my PC, I forgot to put action servlet configuration and struts tag library descriptors in WEB.XML file... here is a snippet of my WEB.XML after the problem was solved <!-- Action Servlet Configuration --> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- Action Servlet Mapping --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <!-- Struts Tag Library Descriptors --> <taglib> <taglib-uri>/WEB-INF/tlds/struts-bean.tld</taglib-uri> <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location> </taglib> ( all my tab libraries reside in /WEB-INF/tlds folder)
最后问题终于解决了,首先我将“WEB-INF”写成了“Web-INF”,直接连web.xml都找不到了。
主要解决方法有两个:
1、将struts.jar直接放到tomcat的lib包中,在Eclipse中的build path可以使用绝对路径
2、将struts.jar放到"WEB-INF/lib"中,tomcat的lib包下就不用放了,然后在Eclipse中的build path 中使用相对路径

还有一个可能的重要原因: 
你使用的struts的tld文件跟你的Struts的jar包的版本冲突!!!
tld文件中声明class为“org.apache.struts.taglib.html.MessagesTei”,但你的struts的
jar包中根本就不存在这个类,自然会抛出ClassNotFoundException

你可能感兴趣的:(java,apache,Web,struts,servlet)