2

I'm running into a bug where I'm able to successfully rendered all the pages on my website using the GAE dev server, but when I deploy the updated version, I get NPE's on every page. I don't see any errors while deploying. There aren't any JSP recompilation errors.

Here's a sample exception:

Uncaught exception from servlet
java.lang.NullPointerException
    at org.apache.jsp.WEB_002dINF.views.index_jsp._jspInit(index_jsp.java:25)
    at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:91)
    ...

The changes I've made have mostly been styling changes and interestingly enough, if I update index.jsp back to what it used to be before my changes, I still get the NPE.

I'm just using standard JSTL with Sitemesh. I've disabled the sitemesh filter to rule that out and still get the error. I'm still using 1.6.3 SDK (since the maven-gae-plugin hasn't been updated yet).

Is there a way to look at the compiled JSP that's being used by GAE?

Tristan
  • 1,077
  • 11
  • 16
  • So I removed the map reduce servlet (which wasn't using anymore) and updated to 1.6.4 and everything seems to be working... I'm not sure which one was the cause. – Tristan Apr 02 '12 at 05:52

3 Answers3

0
  1. Goto the specific line number ( 25 ) from the temporary folder.I am not sure where the temporary folder in GAE is located though.The specific line number might be invoking a method of an object which is null or not initialized.This happens during the jsp page initializatio and not during compilation.

     org.apache.jsp.WEB_002dINF.views.index_jsp._jspInit(index_jsp.java:25)
    
  2. Try clearing the temporary work folder,as you have mentioned that using the old jsp will also throw the error.

  3. I really doubt there is some inline jsp page included in every other jsp page , that inline jsp might be causing the problem too.

Tito
  • 8,894
  • 12
  • 52
  • 86
0
java.lang.NullPointerException
    at org.apache.jsp.WEB_002dINF.views.index_jsp._jspInit(index_jsp.java:25)

The _jspInit() method is not part of your own JSP code. It's part of JSP's internal code. You cannot fix it by fixing your own JSP code.

This exception is however typical when you're including a servletcontainer specific JSP API JAR file in your webapp's /WEB-INF/lib folder and that JAR file is of a different servletcontainer make/version than the servletcontainer where you're actually deploying your WAR to.

You should absolutely not include servletcontainer specific libraries in /WEB-INF/lib. Remove them all. The servletcontainer is the one who's responsible for providing them. The /WEB-INF/lib should contain only webapp-specific libraries. See also this answer for an explanation of the most common cause why some starters drop servletcontainer specific libraries in /WEB-INF/lib for no apparent reason: How do I import the javax.servlet API in my Eclipse project?

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thanks. I believe that GAE updated their JSP api between 1.6.3 and 1.6.4, which made the compiled JSPs that were uploaded break. – Tristan Apr 02 '12 at 18:17
0

It turned out that switching to GAE 1.6.4 APIs fixed the problem. I think it may have been caused by uploading a 1.6.3 compiled JSP.

Tristan
  • 1,077
  • 11
  • 16