FinalizeParams failed when accessing custom component from Java

Marcus Better <[email protected]> Wed, 01 Aug 2007 13:54:42 +0200
Newsgroups gmane.comp.mozilla.devel.java
Message-ID <46B07482.3030404__12270.0144690045$1185969326$gmane$org@bindows.net>
Hi,

I have implemented some XPCOM components in JavaScript, but when I try 
to access them, JavaXPCOM throws an exception like this:

org.mozilla.xpcom.XPCOMException: FinalizeParams failed  (0x80004005)
	at org.mozilla.xpcom.internal.XPCOMJavaProxy.callXPCOMMethod(Native Method)
	at 
org.mozilla.xpcom.internal.XPCOMJavaProxy.invoke(XPCOMJavaProxy.java:143)
	at $Proxy0.getServiceByContractID(Unknown Source)


This is thrown by getServiceByContractID() called from my Java code:

	Mozilla moz = Mozilla.getInstance();
	MyComponent comp = (MyComponent)moz
		.getServiceManager().getServiceByContractID(
		"@example.org/MyComponent;1",
		MyComponent.MYCOMPONENT_IID_STRING);

The application is an Eclipse RCP application (Eclipse 3.3.0 on Windows 
XP) using the SWT-embedded Mozilla browser (Eclipse plug-ins 
org.mozilla.xulrunner 1.8.1.3-20070404 and org.mozilla.xpcom 
1.8.1.3-20070320).

Some relevant background:
*I know that my component is registered with XPCOM and working because I 
can access it from JavaScript.
*I can use JavaXPCOM to access components provided by Mozilla, only my 
own custom component doesn't work.
*The getServiceByContractID() call succeeds if I ask for the nsISupports 
interface instead, but then a further QI to MyComponent generates the 
same exception.
*The interface definition for MyComponent was generated from IDL and 
compiled into my application. It looks like this:

------------------------------------
package org.example.xpcom;

import org.mozilla.interfaces.nsISupports;

public interface MyComponent extends nsISupports
{
     public static final String MYCOMPONENT_IID_STRING =
         "{c262f511-e59c-47f5-9642-4376076022b4}";

     /* OtherComponent getFoo(in string id); */
     public OtherComponent getFoo(String id);
}
------------------------------------

(Note that I manually added the "package org.example.xpcom" line.)

Any help is greatly appreciated.

Cheers,

Marcus