Search code examples
javatomcatstripes

Unable to read TLD "META-INF/stripes.tld" from JAR file error


I'm encountering a bit of an unusual error after a major upgrade of our web application to ivy for build management which also included updating all of the major libraries involved as well. While we are managing to pass our unit tests, when we deploy the web application to Tomcat and try to navigate to it in the brower we get the following error:

org.apache.jasper.JasperException: /index.jsp(1,1) /layout/taglibs.jsp(2,77) Unable to read TLD "META-INF/stripes.tld" from JAR file "file:/Library/Tomcat/apache-tomcat-6.0.32/webapps/cga/WEB-INF/lib/stripes-1.5.6.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: net.sourceforge.stripes.tag.ErrorsTagExtraInfo

I've checked the usual suspects and verified that the jar file is in the correct location, that the tld file is present in the jar, and so forth. Likewise, searching for the error shows only a limited number of returns, primarily related to a mailing list question with the same error. I've gone through that post and also tried those solutions with not much luck.

Any ideas as to what might be causing this error?

The full error trace that I'm receiving is as follows:

org.apache.jasper.JasperException: /index.jsp(1,1) /layout/taglibs.jsp(2,77) Unable to read TLD "META-INF/stripes.tld" from JAR file "file:/Library/Tomcat/apache-tomcat-6.0.32/webapps/cga/WEB-INF/lib/stripes-1.5.6.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: net.sourceforge.stripes.tag.ErrorsTagExtraInfo
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
    org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:300)
    org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:333)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:442)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1397)
    org.apache.jasper.compiler.Parser.parse(Parser.java:130)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Solution

  • This actually took awhile to chase down as the error message is not entirely reflective of what the actual problem is, but in a nut shell this an similar sounding errors (i.e. "Unable to read TLD “META-INF/*.tld” from JAR file") seem to occur when there is a class conflict between one the JAR files that you have deployed and what is deployed with Tomcat itself. This turned out to be the case for my error as there were two files in place (javax.servlet.jsp-api-2.2.1.jar and el-api-1.0.jar) that were conflicting.

    As this issue seems to popup quite a bit, here are a couple troubleshooting tips:

    • Double check what you are deploying to make sure there is nothing unexpected, if you are using a dependency manager make sure the dependency of a dependency isn't causing you problems.
    • Double check to make sure you have cleared everything out of previous version and deploy again, surprisingly this caught me more than once causing some frustration.
    • Don't include servlet-api.jar directly in your own lib but rather use an external JAR with a variable path - guide.
    • Don't expect JAR files to be named as you expect or for them to not contain something you don't think they would have, if you have to, open them up to double check the contents.