Hi!
What could be the possible reasons that:
public void onServerInit(IServer server)
{
IVHost vhost = null;
IApplication application = null;
IApplicationInstance app = null;
application = vhost.getApplication(appName); // appName = "myApp"
app = application.getAppInstance(appInstName); // appInstName = "_definst_"
....
}
This sequence would return app == null ?? The vhost is found (not null), the application is found (not null), but trying to get appInstance returns null. There are no errors reported by the startup log. (except that this variable is null). Once the server starts, the application works fine, only my code which depends upon it does not work.
Thanks!
Atmapuri
Hi Atmapuri,
Do this first:
vhost.startApplicationInstance(appName, appInstName)
Richard
Try it like this, which works in my test:
public void onServerInit(IServer server) {
WMSLoggerFactory.getLogger(null).info("onServerInit");
IVHost vhost = VHostSingleton.getInstance(VHost.VHOST_DEFAULT);
IApplication application ;
IApplicationInstance app ;
vhost.startApplicationInstance("vod","_definst_");
while (true)
{
application = vhost.getApplication("vod");
if (!application.equals(null));
break;
}
app = application.getAppInstance("_definst_");
}
Richard
It turns out, if I dont try to debug the code mentioned (no breakpoint), then this line is not needed:
vhost.startApplicationInstance(appName, appInstName)
Somehow getAppInstance returns a valid object and everything works fine. Now I have put breakpoint after the getAppInstance. Is that usual behaviour?