Can someone explain if creating an object of a class that have in constructor the super call and the super class are missing from dependencies jar could throw a null pointer exception?
e.g. a class that ApplicationFrame extends javax.xml.ws.Service and as construct let say it's:
ApplicationFrame(String wsdlLocation, QName namespace){
super(wsdlLocation, namespace);
}
When doing this I receive a NPE. It's possible?
-
3My gut says it should throw a ClassNotFound when trying to load the class with the missing parent.ratchet freak– ratchet freak2015年07月15日 12:20:07 +00:00Commented Jul 15, 2015 at 12:20
1 Answer 1
No. rachet's gut feeling is spot on. Unless the classloader is overridden, the classloader loads the parent before it loads a class and if that parent isn't there, you would receive a ClassNotFoundException, and not a NullPointerException.
However, you should consider the possibility that some code in a static block is being run in the parent class that does throw a NullPointerException. This happens before you even enter the constructor, so you should probably put a breakpoint in your constructor to see if that is the case.
The same can be said for a static block in your own class if you have one, so in that case, I would double-check that your own static block isn't causing the problem.
Hope that helps!