Results 1 to 4 of 4

Thread: GetAppInstance returns null!

  1. #1

    Default GetAppInstance returns null!

    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

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Hi Atmapuri,

    Do this first:

    vhost.startApplicationInstance(appName, appInstName)
    Richard

  3. #3

    Default

    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?

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    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

Similar Threads

  1. Replies: 5
    Last Post: 06-13-2014, 10:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •