about xpcommexception

[email protected]
Newsgroups gmane.comp.mozilla.devel.java
Organization http://groups.google.com
Message-ID <1175174924.757459.163190__43965.7190851451$1175175041$gmane$org@y66g2000hsf.googlegroups.com>
Hi,
I tried to execute the following example given in the javaxpcom page

     Mozilla moz = Mozilla.getInstance();
     nsIServiceManager serviceManager = moz.getServiceManager();
     nsIAppStartup appStartup =
(nsIAppStartup)serviceManager.getServiceByContractID("@mozilla.org/
toolkit/app-startup;1", nsIAppStartup.NS_IAPPSTARTUP_IID);
     nsIWindowCreator windowCreator =
(nsIWindowCreator)appStartup.queryInterface(nsIWindowCreator.NS_IWINDOWCREATOR_IID);

     nsIWindowWatcher windowWatcher =
(nsIWindowWatcher)serviceManager.getServiceByContractID("@mozilla.org/
embedcomp/window-watcher;1", nsIWindowWatcher.NS_IWINDOWWATCHER_IID);
     windowWatcher.setWindowCreator(windowCreator);

     nsIDOMWindow win = windowWatcher.openWindow(null, "chrome://your-
app/content/window.xul", "mywindow", "chrome,resizable,centerscreen",
null);
     windowWatcher.setActiveWindow(win);
      appStartup.run();

but it showing error
Exception in thread "main" org.mozilla.xpcom.XPCOMException: Attempt
to use unitialized XPCOM object  (0x80004003)
        at org.mozilla.xpcom.Mozilla.getServiceManager(Mozilla.java:
715)

i am using Redhat enterprise linux v4....
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.