You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Jaime Hablutzel Egoavil <ha...@gmail.com> on 2009/12/14 16:00:22 UTC
Call native methods in a DLL from servicemix bundle
Hi, last month I was testing servicemix, now I want to try to implement it,
and I want to know if there is a way to connect to native windows .dll from
inside a servicemix bundle, I make this question because I have knowledge
that there are several restrictions inside of servicemix, like for ldap.
I'm thinking in using a library like this one:
http://johannburkard.de/blog/programming/java/Call-native-methods-in-a-DLL-from-Java-without-JNI.html
or maybe JNI (that I don't know quite well yet).
Thank you.
--
Jaime Hablutzel
(tildes omitidas intencionalmente) 9 8964 0369
Re: Call native methods in a DLL from servicemix bundle
Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,
I guess you're using ServiceMix 4, so if you want to use this JAR
inside the OSGi container you would have to OSGi-fy it first. You can
do that at runtime by installing it with osgi:install -s
wrap:mvn:org.jvnet.com4j/com4j/20080107 or build a bundle for it
(http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/ has
plenty of examples on how to do that).
If you're only using it inside a single bundle, you could also embed
the jar in that bundle directly with the felix maven-bundle-plugin,
but if you ever plan on using COM objects from multiple bundles, one
of the first two options would be better.
Regards,
Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/
2009/12/16 Jaime Hablutzel Egoavil <ha...@gmail.com>:
> I didn't get to connect to the COM Methods inside the DLL using JNA, I think
> because it is for generic DLL, and this one was a COM Object really packaged
> inside a DLL, or something like that, I'm not really familiar with Microsoft
> technologies, whatever, I found com4j, that with a simple command as this:
>
> D:\jaime\software\com4j-20080107>java -jar tlbimp.jar -o wsh -p test.wsh
> D:\temp\soasighhc.dll
>
> Generated the complete stub and a Factory class to create instances of my
> COM OBject, It works just fine, and I want to know if there is not any
> problem using this library inside servicemix.
>
> <dependency>
> <groupId>org.jvnet.com4j</groupId>
> <artifactId>com4j</artifactId>
> <version>20080107</version>
> </dependency>
>
> Thank you.
>
>
> On Mon, Dec 14, 2009 at 10:35 AM, Jaime Hablutzel Egoavil <
> hablutzel1@gmail.com> wrote:
>
>> Thank you, I'll try it.
>>
>>
>> On Mon, Dec 14, 2009 at 10:09 AM, Jean-Baptiste Onofré <jb...@nanthrax.net>wrote:
>>
>>> Hi Jaime,
>>>
>>> Another way is to use JNA.
>>>
>>> JNI works fine but you need to implement your lib wrapper. So you need to
>>> provide some C code. JNI is provided by the JDK.
>>>
>>> With JNA (Java Native Access) is API that give you access to lib directly
>>> (without middle tier wrapper).
>>>
>>> https://jna.dev.java.net/
>>>
>>> Regards
>>> JB
>>>
>>>
>>> Jaime Hablutzel Egoavil wrote:
>>>
>>>> Hi, last month I was testing servicemix, now I want to try to implement
>>>> it,
>>>> and I want to know if there is a way to connect to native windows .dll
>>>> from
>>>> inside a servicemix bundle, I make this question because I have knowledge
>>>> that there are several restrictions inside of servicemix, like for ldap.
>>>>
>>>> I'm thinking in using a library like this one:
>>>>
>>>>
>>>> http://johannburkard.de/blog/programming/java/Call-native-methods-in-a-DLL-from-Java-without-JNI.html
>>>>
>>>> or maybe JNI (that I don't know quite well yet).
>>>>
>>>> Thank you.
>>>>
>>>>
>>> --
>>> Jean-Baptiste Onofré (Nanthrax)
>>> BuildProcess/AutoDeploy Project Leader
>>> http://buildprocess.sourceforge.net
>>> jb@nanthrax.net
>>> PGP : 17D4F086
>>>
>>
>>
>>
>> --
>> Jaime Hablutzel
>>
>> (tildes omitidas intencionalmente) 9 8964 0369
>>
>
>
>
> --
> Jaime Hablutzel
>
> (tildes omitidas intencionalmente) 9 8964 0369
>
Re: Call native methods in a DLL from servicemix bundle
Posted by Jaime Hablutzel Egoavil <ha...@gmail.com>.
I didn't get to connect to the COM Methods inside the DLL using JNA, I think
because it is for generic DLL, and this one was a COM Object really packaged
inside a DLL, or something like that, I'm not really familiar with Microsoft
technologies, whatever, I found com4j, that with a simple command as this:
D:\jaime\software\com4j-20080107>java -jar tlbimp.jar -o wsh -p test.wsh
D:\temp\soasighhc.dll
Generated the complete stub and a Factory class to create instances of my
COM OBject, It works just fine, and I want to know if there is not any
problem using this library inside servicemix.
<dependency>
<groupId>org.jvnet.com4j</groupId>
<artifactId>com4j</artifactId>
<version>20080107</version>
</dependency>
Thank you.
On Mon, Dec 14, 2009 at 10:35 AM, Jaime Hablutzel Egoavil <
hablutzel1@gmail.com> wrote:
> Thank you, I'll try it.
>
>
> On Mon, Dec 14, 2009 at 10:09 AM, Jean-Baptiste Onofré <jb...@nanthrax.net>wrote:
>
>> Hi Jaime,
>>
>> Another way is to use JNA.
>>
>> JNI works fine but you need to implement your lib wrapper. So you need to
>> provide some C code. JNI is provided by the JDK.
>>
>> With JNA (Java Native Access) is API that give you access to lib directly
>> (without middle tier wrapper).
>>
>> https://jna.dev.java.net/
>>
>> Regards
>> JB
>>
>>
>> Jaime Hablutzel Egoavil wrote:
>>
>>> Hi, last month I was testing servicemix, now I want to try to implement
>>> it,
>>> and I want to know if there is a way to connect to native windows .dll
>>> from
>>> inside a servicemix bundle, I make this question because I have knowledge
>>> that there are several restrictions inside of servicemix, like for ldap.
>>>
>>> I'm thinking in using a library like this one:
>>>
>>>
>>> http://johannburkard.de/blog/programming/java/Call-native-methods-in-a-DLL-from-Java-without-JNI.html
>>>
>>> or maybe JNI (that I don't know quite well yet).
>>>
>>> Thank you.
>>>
>>>
>> --
>> Jean-Baptiste Onofré (Nanthrax)
>> BuildProcess/AutoDeploy Project Leader
>> http://buildprocess.sourceforge.net
>> jb@nanthrax.net
>> PGP : 17D4F086
>>
>
>
>
> --
> Jaime Hablutzel
>
> (tildes omitidas intencionalmente) 9 8964 0369
>
--
Jaime Hablutzel
(tildes omitidas intencionalmente) 9 8964 0369
Re: Call native methods in a DLL from servicemix bundle
Posted by Jaime Hablutzel Egoavil <ha...@gmail.com>.
Thank you, I'll try it.
On Mon, Dec 14, 2009 at 10:09 AM, Jean-Baptiste Onofré <jb...@nanthrax.net>wrote:
> Hi Jaime,
>
> Another way is to use JNA.
>
> JNI works fine but you need to implement your lib wrapper. So you need to
> provide some C code. JNI is provided by the JDK.
>
> With JNA (Java Native Access) is API that give you access to lib directly
> (without middle tier wrapper).
>
> https://jna.dev.java.net/
>
> Regards
> JB
>
>
> Jaime Hablutzel Egoavil wrote:
>
>> Hi, last month I was testing servicemix, now I want to try to implement
>> it,
>> and I want to know if there is a way to connect to native windows .dll
>> from
>> inside a servicemix bundle, I make this question because I have knowledge
>> that there are several restrictions inside of servicemix, like for ldap.
>>
>> I'm thinking in using a library like this one:
>>
>>
>> http://johannburkard.de/blog/programming/java/Call-native-methods-in-a-DLL-from-Java-without-JNI.html
>>
>> or maybe JNI (that I don't know quite well yet).
>>
>> Thank you.
>>
>>
> --
> Jean-Baptiste Onofré (Nanthrax)
> BuildProcess/AutoDeploy Project Leader
> http://buildprocess.sourceforge.net
> jb@nanthrax.net
> PGP : 17D4F086
>
--
Jaime Hablutzel
(tildes omitidas intencionalmente) 9 8964 0369
Re: Call native methods in a DLL from servicemix bundle
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jaime,
Another way is to use JNA.
JNI works fine but you need to implement your lib wrapper. So you need
to provide some C code. JNI is provided by the JDK.
With JNA (Java Native Access) is API that give you access to lib
directly (without middle tier wrapper).
https://jna.dev.java.net/
Regards
JB
Jaime Hablutzel Egoavil wrote:
> Hi, last month I was testing servicemix, now I want to try to implement it,
> and I want to know if there is a way to connect to native windows .dll from
> inside a servicemix bundle, I make this question because I have knowledge
> that there are several restrictions inside of servicemix, like for ldap.
>
> I'm thinking in using a library like this one:
>
> http://johannburkard.de/blog/programming/java/Call-native-methods-in-a-DLL-from-Java-without-JNI.html
>
> or maybe JNI (that I don't know quite well yet).
>
> Thank you.
>
--
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086