Thursday, February 10, 2011

Unable to read TLD "META-INF/tld/tiles-jsp.tld" from JAR file

I got this strange error saying:


org.apache.jasper.JasperException: Unable to read TLD "META-INF/tld/tiles-jsp.tld" from JAR file "file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MY_APP/WEB-INF/lib/tiles-jsp-2.0.4.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.tiles.jsp.taglib.UseAttributeTag$Tei
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:181)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:182)
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:386)
    .........



It turns out that I have both jsp-api.jar and tiles-jsp-2.*.jar in WEB-INF/lib together in my deployment folder.  They don't seem to like each other in the same place.  By removing jsp-api.jar, the problem is gone. 
Normally, jsp-api.jar should not be bundled in the war because all application server should have jsp-api.jar in their common library.  So this jar should not exists in application WEB-INF/lib folder.  The reason I had it in my project is because a bug currently exists in Eclipse Maven (m2e) plugin that includes jar files even they are set to provided scope.  In my project pom.xml I set the jsp-api to have the 'provided' scope.  However, the plugin still push the jar into my maven dependencies which are then port over to my tomcat deploy folder.  This is a known issue in Maven plugin.  If you have the same issue with me and has to use maven and tomcat together, you need to delete the file manually after server synchronization.  I wrote a simple batch file on my desktop as a short cut to delete the file.  Until the bug is fixed, this is the only workaround....

Eclipse version: Helio build 20100917-0705
M2E plugin version: 1.0.100.20110804-1717

No comments :

Post a Comment