cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

java.lang.NullPointerException

Former Member
0 Likes
2,917

Hi All,

Can Any one tell me abt java.lang.NullPointerException.

when we will get this type of error and how to solve this.

if we get this error where we have to check the error.

View Entire Topic
Former Member
0 Likes

Hi Sreelakshmi,

You get a Null Pointer Exception, when you are trying to use (not just read , but use) an object which has null value ( eg: when you try to invoke a function on a null object). It is something like, there is no object created on the heap, but still you are trying to invoke a method using this non-existent object.

Below are some ways of seeing the details of this exception:

1. Wrap your code in a try- catch block. In the catch block write the code :

try{......[code]....... }

catch(Exception e) {

e.printStackTrace();

wdComponentAPI.getMessageManager().reportException(e.getMessage());

}

This will display the exception on the screen.

2. If you are unable to see the exception, then go to:

http://[server-name]:[port-no]/nwa -> Problem Management -> Logs and Traces -> Log Viewer -> Show: General View and Select View as "Default Trace (Java)".

Hope this helps.

Regards,

Gaurav.

Edited by: Gaurav Narkar on May 14, 2009 9:39 AM

Ask a Question