nullPointerException while linking jsp file to mysql -
http status 500 - internal server error
type exception report
messageinternal server error
descriptionthe server encountered internal error prevented fulfilling request.
exception
org.apache.jasper.jasperexception: java.lang.nullpointerexception
root cause
java.lang.nullpointerexception
note full stack traces of exception , root causes available in glassfish server open source edition 4.0 logs.
glassfish server open source edition 4.0
i'm not able open stack trace. log file under domain empty. pls help
nullpointerexception
means trying call non-static method (or attribute) of object not defined.
example:
string s = "foo"; system.out.println(s.length());
this code prints 3, because length of foo
3, , s
has been initialized foo
.
example nullpointerexception
:
string s = null; system.out.println(s.length());
here s
null
, try call method length()
, non-static method. nullpointerexception
: there no sense length of "nothing" (null
).
nevertheless, still can call static methods s
:
string s = null; system.out.println(s.valueof('a'));
prints a
. note not way call static methods.
the static method valueof(char) type string should accessed in static way
this warning explains should access valueof(char)
way:
system.out.println(string.valueof('a'));
now let find error in code because didn't share it.
Comments
Post a Comment