Bug 59640

Summary: provide better error message on TldCache.getTaglibXml TldResourcePath problem
Product: Tomcat 8 Reporter: Ralf Hauser <hauser>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.0.14   
Target Milestone: ----   
Hardware: All   
OS: Linux   

Description Ralf Hauser 2016-05-30 10:17:17 UTC
quite some users appear to be affected by this backward incompatibility when migrating to tomcat8

- http://marc.info/?l=tomcat-user&w=2&r=1&s=TldResourcePath&q=b

- http://stackoverflow.com/questions/28296543/nullpointerexception-when-add-custom-taglib-in-jsp 

- http://stackoverflow.com/questions/25902137/error-compiling-jsps-in-apache-tomcat-8-0-12 

- https://github.com/Confluex/Zuul/issues/76

just to name a few.

To alleviate the situation, please

1) cite the taglib-uri sought when it happens
2) cite the taglib-location sought when it happens
3) add the URL of a wiki or help page assisting to solve the problem



HTTP Status 500 - Unable to compile class for JSP

type Exception report

message Unable to compile class for JSP

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:579)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	org.apache.catalina.filters.ExpiresFilter.doFilter(ExpiresFilter.java:1200)
root cause

java.lang.NullPointerException
	org.apache.tomcat.util.descriptor.tld.TldResourcePath.hashCode(TldResourcePath.java:156)
	java.util.HashMap.hash(HashMap.java:338)
	java.util.HashMap.get(HashMap.java:556)
	org.apache.jasper.compiler.TldCache.getTaglibXml(TldCache.java:95)
	org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:179)
	org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:411)
	org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1428)
	org.apache.jasper.compiler.Parser.parse(Parser.java:139)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	org.apache.catalina.filters.ExpiresFilter.doFilter(ExpiresFilter.java:1200)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.14 (Debian) logs.
Comment 1 Mark Thomas 2016-06-01 15:08:23 UTC
remm had already fixed this for 9.0.0.M6 and 8.5.2. I back-ported it to 8.0.x for 8.0.36 onwards.