NullPointerException error confirmation.
I am getting a 'NullPointer Exception' on executing a 3rd Party code.
It has a class called Controller(which has a static method that returns an instance of the class).
publicclass Controller
{
privatestatic Controller instance;
publicstatic Controller getInstance()
{
return instance;
}
publicstaticvoid main(String[] args)throws Exception
{
String sz_runcommand ="Controller START/STOP userdefined_config_file";
instance =new Controller(args[1]);
if (args[0].equals("START"))
{
instance.start();
}
elseif (args[0].equals("STOP"))
{
instance.stop();
}
}
}
The Controller class is then being used in a different class :
publicclass InternalClient{
//.....
NodeList nodes = Controller.getInstance().getConfig().getNodeList("/Configuration/*");
}
I am sure that 'NullPointerException' is due to Controller.getInstance().getConfig().getNodeList() used above will return 'null' as
when the Controller class is loaded,the static method getInstance() is executed first and returns null.
Am I correct in the above?
Even after instantiating the Controller class,it returns NULL.

