Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Using COM via JNI leads to class not registered exception
Using COM via JNI leads to class not registered exception [message #135570] Mon, 13 July 2009 07:16 Go to next message
Tobias Koetter is currently offline Tobias KoetterFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,
I'm using com4j to use a COM dll written in C# from java. Using the COM
interface in the main method of a java application works. If I'm using the
same com4j methods in an eclipse plugin the following exception in the
native C++ code of the com4j dll occurs: "80040154 CoCreateInstance failed
: Class not registered" (com4j.cpp line 135).

What I have tryed so far:
Using the C# COM interface in a java main class using com4j->works
Using other existing COM interfaces written in C++ via com4j in an eclipse
plugin->works

Placing the dll that implements the COM interface in the root path of the
plugin-> does not work
Using Bundle-NativeCode in the manifest to include the com4j and COM
interface dll-> does not work

I have also tryed another java<->com bridge JACOB that showed the same
behaviour. Works in a java main but not in an eclipse plugin.

Why does it work in a java application but not in an eclipse plugin?
What is the differences using jni in a java application and in an eclipse
plugin?
Why does the com4j native code finds the COM interface in the registry and
the eclipse plugin does not?

Thanks a lot for your help!
Re: Using COM via JNI leads to class not registered exception [message #135672 is a reply to message #135570] Thu, 16 July 2009 12:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dleskov.excelsior-usa.com

I recall it may have something to do with threads, that is, when
initialization and usage occur in different threads. Sorry I do not have
more detail.

Dmitry

On Mon, 13 Jul 2009 14:16:52 +0700, Tobias Koetter
<tobias.koetter@gmx.net> wrote:

> Hi,
> I'm using com4j to use a COM dll written in C# from java. Using the COM
> interface in the main method of a java application works. If I'm using
> the same com4j methods in an eclipse plugin the following exception in
> the native C++ code of the com4j dll occurs: "80040154 CoCreateInstance
> failed : Class not registered" (com4j.cpp line 135).
>
> What I have tryed so far:
> Using the C# COM interface in a java main class using com4j->works
> Using other existing COM interfaces written in C++ via com4j in an
> eclipse plugin->works
>
> Placing the dll that implements the COM interface in the root path of
> the plugin-> does not work
> Using Bundle-NativeCode in the manifest to include the com4j and COM
> interface dll-> does not work
>
> I have also tryed another java<->com bridge JACOB that showed the same
> behaviour. Works in a java main but not in an eclipse plugin.
>
> Why does it work in a java application but not in an eclipse plugin?
> What is the differences using jni in a java application and in an
> eclipse plugin? Why does the com4j native code finds the COM interface
> in the registry and the eclipse plugin does not?
>
> Thanks a lot for your help!
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: Using COM via JNI leads to class not registered exception [message #135920 is a reply to message #135672] Mon, 20 July 2009 14:01 Go to previous message
Tobias Koetter is currently offline Tobias KoetterFriend
Messages: 2
Registered: July 2009
Junior Member
Thanks Dmitry for your reply.
The problem occurs only if I debug/start the plugin from eclipse. If I
deploy the plugin to a stand alone eclipse rcp the plugin works as
expected.
Tobias
Previous Topic:Purpose of Specifying update Site in a feature with p2?
Next Topic:How to use p2 to install a standalone product
Goto Forum:
  


Current Time: Fri Apr 26 04:20:23 GMT 2024

Powered by FUDForum. Page generated in 0.02628 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top