This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes JSP and the fly likes java.lang.NullPointerException on a jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "java.lang.NullPointerException on a jsp page " Watch "java.lang.NullPointerException on a jsp page " New topic
Author

java.lang.NullPointerException on a jsp page

Ann Enzen
Greenhorn

Joined: Jan 02, 2012
Posts: 5
Hi,
I m getting an error when I try to run the jsp below.


I get the following error when I run the page.





Please let me know the possible causes of this error.Thank You
Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125
Check your web descriptor file.

Provide your server details.. for further analysis
Ann Enzen
Greenhorn

Joined: Jan 02, 2012
Posts: 5
Server details:Tomcat v7.0

web descriptor file is as shown below:
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1027
I don't see anything obvious in the jsp you posted that would cause this.
In fact I don't see any java code at all in there, so a null pointer exception is quite difficult to create.

you did post the source of frameset.jsp right?
Is there a 'caused by' on this stack trace?
Ann Enzen
Greenhorn

Joined: Jan 02, 2012
Posts: 5
Stefen this is all we have. There is no 'caused by' in the error log and yes i did post the code for frameset.jsp

Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1027
Well the only bit of JSP markup I see in that file is the directive at the top.
Everything else is template text.


Try removing this line. Does it work?

Are there any other errors in the Tomcat log? At startup maybe?

You're working with Tomcat, so check out the file [Tomcat]/work/Catalina/localhost/JasperCIS/org/apache/jsp/frameset_jsp.java (or something similar)
This is the Servlet file Tomcat generates from your JSP. Whats on line 22 that can create a null pointer exception?

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

The OP may want to try cleaning out unnecessary references in the form of jar files, this may cause it to give unexplained errors.


Learning and Learning!-- Java all the way!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61762
    
  67

Vic may be onto something. Sometimes the most inexplicable things can happen when the servlet or JSP jars are included in WEB-INF/lib. What jars have been placed there?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ann Enzen
Greenhorn

Joined: Jan 02, 2012
Posts: 5
Yes,there were unnecessary jar files in the WEB-INF/LIB as well as in the build path of the project.Once all this was cleaned it worked fine.There were jars such as jsp-api.jar,servlet-api.jar and many more such jar files which were not needed. Thank you all for your help.
 
jQuery in Action, 2nd edition
 
subject: java.lang.NullPointerException on a jsp page