File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes Null Pointer Exception in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Null Pointer Exception in jsp" Watch "Null Pointer Exception in jsp" New topic

Null Pointer Exception in jsp

Shashi Kant
Ranch Hand

Joined: Aug 08, 2006
Posts: 117
Hi All

I am getting NullPointerException when try to access Login.jsp

I had debug through the jsp and following line throwing the exception.

This error comes when I deployed the application on WAS 6.0, but it is running fine in WAS 5.0

What may be the problem?
[ March 14, 2007: Message edited by: Shashikant Dahatonde ]

If it's true that we are here to help others, then what exactly are the others here for?
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Try printing your User-Agent header to make sure it isn't null.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sunil Vasudevan
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
With the code snippet that you have provided, seems that request.getHeader("User-Agent") is returned null.

Can you try logging or printing the value of request.getHeader("User-Agent")?

This should be checked with WAS 6.0 support(It is strange...)

Sunil.V<br />SCJP2, SCWCD1.4, SCBCD1.3
Shashi Kant
Ranch Hand

Joined: Aug 08, 2006
Posts: 117

Thanks for replying.

I had tried printing the value of "request.getHeader("User-Agent")"

It prints "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"

So the returns True.

I also tried putting in try catch block. And here only i get the NullPointerException.

Please help soon
Sunil Vasudevan
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
Can you print your entire code? Have you set response = null anywhere by mistake?

If the same code is working in WAS 5.1 and not in WAS 6.0, then the best bet is to check with Websphere guys.

WAS 6.0 was notorious for bugs. Which version of WAS are you using. I mean the minor version (Example: etc)
I agree. Here's the link:
subject: Null Pointer Exception in jsp
Similar Threads
designing error pages
Problem while accessing page var using EL
JSP error page and exception handle