2

i got this exception everytime i try to load my webapp:

exception

org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:538)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
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)

root cause

java.lang.NullPointerException
org.apache.jsp.index_jsp._jspInit(index_jsp.java:22)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:164)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
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)

how can i solve this exception?

Br3x
  • 754
  • 4
  • 10
  • 21
  • I have the same error, I tried below solutions but still am getting the error, any help please..... – sailaja Jan 25 '13 at 06:54

2 Answers2

3

I had also faced the same problem. I got the solution to solve this problem.

Root of this problem is: I had added the servlet-api.jar and jsp-api.jar in my application lib directory. If Apache-tomcat is used to run application then its not necessary to add this jar files in our lib directory.

Solution:

  • Goto build Path -> add external jars from tomcat-lib dir.
  • Instead of adding(copying) it in lib dir of application.

If have any problem, contact me.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
Nagesh
  • 31
  • 2
0

Set the keepgenerated configuration of Tomcat to true (see http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html), clean tomcat's work directory, restart tomcat, reproduce the problem, and look what happens in index_jsp.java at line 22. It probably is some scriptlet which generates this exception. (and you should avoid scriptlets. See How to avoid Java code in JSP files?

Community
  • 1
  • 1
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
  • 1
    Replace the 7 by a 6 in the URL I gave you, and you'll find the same doc for Tomcat 6. Not too hard, is it? And you might find this website helpful: http://www.google.com – JB Nizet Dec 20 '11 at 12:39
  • 1
    thanks, and no need for making jokes, we're all learning here... – Br3x Dec 20 '11 at 12:45
  • 2
    Yes, but you're also supposed to show some research effort. Finding documentation on Tomcat isn't hard at all, especially if you already have the URL for the documentation of another version. – JB Nizet Dec 20 '11 at 12:47