File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes java.lang.NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "java.lang.NullPointerException" Watch "java.lang.NullPointerException" New topic
Author

java.lang.NullPointerException

leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
hi guys how do i could fix this error

java.lang.NullPointerException


thanks in advance
Bajrang Asthana
Ranch Hand

Joined: May 24, 2011
Posts: 32
When you try to access any property of an object that is null or have no instance attached with it.

for example:

Class Test{
int x;
public int getX(){
return x;
}
public void static main(String args[]){

Test test =null;
test.getX(); // Here you get java.lang.NullPointerException

}

}

to deal with this exception, you should first check the reference of object for null then access any method or property of associated to an object.

something similar-

if(null != test){
test.getX();
}
H Jetly
Ranch Hand

Joined: Aug 26, 2010
Posts: 41

I think you should post such questions in Java In General Forum


Harsh Jetly
leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
hi guys thanks for reply this is about jsf and richfaces so i post in this section
b.t.w this is my code please corect me
ok first this is error i' got
when i tried to click edit button so when popup panel is appear then i change the value in the field then i click save button then this error come out







this is my code KelompokBiayaConverter.java

help me out please,...
if you think that im wrong please tell me what should i change or add the code

thanks guys
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

So which line in your sample code is "line 30"?


Customer surveys are for companies who didn't pay proper attention to begin with.
leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
Tim Holloway wrote:So which line in your sample code is "line 30"?


hi tim thanks for reply in those line,,
line 30 is at line 14
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
Check whether controller is null or whether getKelompokBiayaJpaController() method returns null. Based on your error message (I presume that you showed the root cause correctly) the controller object is null. So you have to find out why either MasterBiyanMbean is not present or why fetching the object does not work. Very basic stuff (null checks and all).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.lang.NullPointerException