1828747 Members
3120 Online
109985 Solutions
New Discussion

HP - UNIX JVM

 
omkumar
New Member

HP - UNIX JVM

Can anyone help me out why i am getting this exception?. What are the possible reasons? I think, i allocated enough memory to the JVM. But still it's not printing the stack trace.

java.lang.NullPointerException
<>
3 REPLIES 3
Adam J Markiewicz
Trusted Contributor

Re: HP - UNIX JVM

Hi

I think you're using the object somewhere that hasn't been constructed before.

AFAIK in Java whenever you declare an object of any class, you declare only the reference that has to be initialised with a new constructed object. If you don't do it, I guess, you get NullPointerException.

This rule doesn't fit to builtin basic types, like int etc. - these are declared explicitly, not as reference.

Hope this helps
Good luck
Adam
I do everything perfectly, except from my mistakes
omkumar
New Member

Re: HP - UNIX JVM

Thanks Adam. I declared the ResultSet Object and set it to null. But when i execute the query it should set some value. But it looks like the program is not going to that statment. Because of that when i tried to close it in the finally block, it throws the null pointer exception
Adam J Markiewicz
Trusted Contributor

Re: HP - UNIX JVM

Hi

Mayby this is your problem.
>>
set it to null. But when i execute the query it should set some value
<<
I guess you try to set the value for the object fields. But are you sure you have the object itself? You must have the object before you modify it. Simple setting value to a field won't create a new object.

Good luck
Adam
I do everything perfectly, except from my mistakes