Bug 56177

Summary: JSPC: NPE at org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)
Product: Tomcat 8 Reporter: ludo <ludovic.champenois>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.0.3   
Target Milestone: ----   
Hardware: PC   
OS: Mac OS X 10.4   
Attachments: bug sample

Description ludo 2014-02-22 00:53:11 UTC
When trying to compile a jsp that uses JSTL, I have a NPE in the JSP compiler.

I am attaching a zip that contains a self contained sample showing the bug with correct dependencies via Maven:

Have Maven installed.
Unzip the bug.zip attached file (there is a JSP and a simple Main calling the JSPC compiler with the correct flags)

cd bug/jspcBug
mvn install
mvn exec:java -Dexec.mainClass="bug.JSPCBug"

See the NPE:
ava.lang.NullPointerException
	at org.apache.jasper.servlet.JspCServletContext.getResource(JspCServletContext.java:344)
	at org.apache.jasper.JspCompilationContext.getResource(JspCompilationContext.java:283)
	at org.apache.jasper.JspCompilationContext.getLastModified(JspCompilationContext.java:359)
	at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:138)
	at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:411)
	at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469)
	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1455)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
	at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:229)
	at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:200)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:375)
	at org.apache.jasper.JspC.processFile(JspC.java:1205)
	at org.apache.jasper.JspC.execute(JspC.java:1356)
	at org.apache.jasper.JspC.main(JspC.java:270)
	at bug.JSPCBug.main(JSPCBug.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
	at java.lang.Thread.run(Thread.java:724)
org.apache.jasper.JasperException: java.lang.NullPointerException
Comment 1 ludo 2014-02-22 00:54:48 UTC
Created attachment 31345 [details]
bug sample

Simple Maven project exposing the NPE. It has 1 Main that calls the jsp compiler with correct parameters and the jsp.
The pom.xml has all the correct and latest dependencies.
Comment 2 Mark Thomas 2014-02-24 17:11:20 UTC
Thanks for the report. This has been fixed in 8.0.x and will be included in 8.0.4 onwards.