Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NullPointerException

 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys how do i could fix this error

java.lang.NullPointerException


thanks in advance
 
Bajrang Asthana
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
Google Web Toolkit Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should post such questions in Java In General Forum
 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So which line in your sample code is "line 30"?
 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic