• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.lang.NullPointerException

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys how do i could fix this error

java.lang.NullPointerException


thanks in advance
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
}
 
Ranch Hand
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
reply
    Bookmark Topic Watch Topic
  • New Topic