Failed to invoke method queryInterfaceAggregated

287 views
Skip to first unread message

Jarek

unread,
Sep 26, 2011, 4:28:28 PM9/26/11
to ComfyJ Forum
I have a COM written in Java using ComfyJ. I am using it from C#.
After some recent update of may code I no longer can use it. I am
tying to figure out what is going on. The code is partially executed
the main constructor (with argument CoClassMetaInfo) is called. Some
part of my code, like logging initialization, is executed. Then I am
getting error messages like:

2201 Main message loop DEBUG
com.jniwrapper.win32.com.server.CoInterfaceVTBL SourceFile:56 Failed
to invoke method queryInterfaceAggregated
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.jniwrapper.win32.com.server.CoInterfaceVTBL
$VirtualMethodCallback.b(SourceFile:262)
at com.jniwrapper.win32.com.server.CoInterfaceVTBL
$VirtualMethodCallback.callback(SourceFile:154)
at com.jniwrapper.Callback.enterPoint(SourceFile:223)
at com.jniwrapper.Function.invokeCFunc(Native Method)
at com.jniwrapper.FunctionCall.a(SourceFile:127)
at com.jniwrapper.FunctionCall.call(SourceFile:35)
at com.jniwrapper.Function.invoke(SourceFile:188)
at com.jniwrapper.Function.invoke(SourceFile:212)
at com.jniwrapper.win32.MessageLoopThread
$LoopThread.run(MessageLoopThread.java:486)
Caused by: com.jniwrapper.win32.com.ComException: COM object
method returns error code: 0x80004002; E_NOINTERFACE (No such
interface supported)
at
com.jniwrapper.win32.com.server.IUnknownServer.queryInterface(SourceFile:
93)
at
com.jniwrapper.win32.com.server.IUnknownServer.queryInterfaceAggregated(SourceFile:
111)

Then:

2214 Main message loop ERROR
com.jniwrapper.win32.com.server.IDispatchServer SourceFile:66 Could
not find method: MyMethod in class: class my.company.MyClass
2310 Main message loop DEBUG
com.jniwrapper.win32.com.server.CoInterfaceVTBL SourceFile:56 Failed
to invoke method getIDsOfNames
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.jniwrapper.win32.com.server.CoInterfaceVTBL
$VirtualMethodCallback.b(SourceFile:262)
at com.jniwrapper.win32.com.server.CoInterfaceVTBL
$VirtualMethodCallback.callback(SourceFile:154)
at com.jniwrapper.Callback.enterPoint(SourceFile:223)
at com.jniwrapper.Function.invokeCFunc(Native Method)
at com.jniwrapper.FunctionCall.a(SourceFile:127)
at com.jniwrapper.FunctionCall.call(SourceFile:35)
at com.jniwrapper.Function.invoke(SourceFile:188)
at com.jniwrapper.Function.invoke(SourceFile:212)
at com.jniwrapper.win32.MessageLoopThread
$LoopThread.run(MessageLoopThread.java:486)
Caused by: com.jniwrapper.win32.com.ComException: COM object
method returns error code: 0x80020006; DISP_E_UNKNOWNNAME (Unknown
name.)
at
com.jniwrapper.win32.com.server.IDispatchServer.getIDsOfNames(SourceFile:
158)
... 13 more

Any hints what is going on here?

Thanks,

Jarek

Sergei Piletsky

unread,
Sep 27, 2011, 8:02:05 AM9/27/11
to Jarek, ComfyJ Forum
Hi,

It looks like you have modified the methods of your Java COM server, because there is the following line in the log file:


com.jniwrapper.win32.com.server.IDispatchServer         SourceFile:66   Could not find method: MyMethod in class: class my.company.MyClass

where IDispatchServer complains that it cannot find a required method in the declared class. So, I think you just need to review the code and restore the required methods in your class, if they were changed.

Of course, there could be another cause of the problem, for example your ComfyJ evaluation license license has expired. To verify that you can add the -Dteamdev.license.info=true VM parameter and ComfyJ will print out all license validation information to a Java console.

If it's not the case, and restoring of required method does not help either — you can send us your COM server and we will investigate the issue.

Sincerely,
Serge

Jarek

unread,
Sep 27, 2011, 8:45:24 AM9/27/11
to ComfyJ Forum
I have purchased licence for ComfyJ and it working fine.
I think I narrowed down what is happening. It is related to
inheritance bug or 'peculiar' behavior. The current structure is
something like this

public interface Camera extends IDispatch {
MyMethod
}

public abstract class BaseCamera extends DispatchComServer implements
Camera {
public MyMethod { ... /* implementation */ }
}

public class MyClass extends BaseCamera {
...
}

If I use this structure I am getting error about missing MyMethod in
MyClass.
Now if I add to MyClass that it extends Camera interface everything is
fine:

public class MyClass extends BaseCamera implements Camera {
...
}

It does not make sense to me but it seems to fix the issue (MyClass
already inherits Camera interface through BaseCamera). I will do some
more tests to verify that adding the "implements Camera" is a key
here.

Does it make sense from ComfyJ point of view?


On Sep 27, 8:02 am, Sergei Piletsky <sergei.pilet...@teamdev.com>
wrote:

Sergei Piletsky

unread,
Sep 27, 2011, 10:07:58 AM9/27/11
to Jarek, ComfyJ Forum
The issue can be explained by the fact that during the registration of a Java COM server, a IDispatchServer object retrieves information about its implemented interfaces using the getClass().getInterfaces() method, which returns directly declared interfaces only, not including the interfaces which are implemented in its super classes.

Sincerely,
Serge
Reply all
Reply to author
Forward
0 new messages