|
Re: How to import external .jar and use it in a bundle [message #1709208 is a reply to message #1709204] |
Thu, 24 September 2015 23:19 |
|
Hi Silvio,
There are two ways by which you can achieve this.
1. Convert the non-osgi jar to bundle. You have to use bndtools or eclipse to do so. Once you are done converting your jar to bundle, import the required packages in your own bundle. Create your own bundle which uses those exported packages from the newly created bundle. Then in the OSGi container, install the first OSGi bundle and then your own bundle.
2. Another way is to put the jar in your own bundle and create manifest header mentioning Bundle-Classpath: lib/*.jar (assuming your bundle has a lib folder and it has the jar file). It will work as well.
Thanks and Regards,
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
|
|
|
|
|
Re: How to import external .jar and use it in a bundle [message #1709292 is a reply to message #1709288] |
Fri, 25 September 2015 16:27 |
|
Hi Silvio,
I think something went wrong with your OSGi Container and that's why the framework couldn't find the some of the bundles. Would you please check if this does happen only when you try to install your own bundle or it stays same even when you don't install your bundle. If it is happening due to your bundle, I would advise you to host your source code either in Bitbucket or Github so that we can try solving your issue.
Thanks and Regards,
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
|
|
|
|
|
Re: How to import external .jar and use it in a bundle [message #1709321 is a reply to message #1709304] |
Sat, 26 September 2015 07:10 |
|
Hi Silvio,
As Apache HttpClient Libraries are not provided as OSGi Bundles, you either have to convert it to OSGi Bundle or put it in Bundle Classpath using Bundle-Classpath manifest header. There should not be any problem if you put it in Bundle's Classpath as it is same for any non-osgi library to be used in any Bundle's Classpath. If you still encounter any problem, you can host your bundle somewhere so that we can have a look together to find the issue.
Thanks and Regards,
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
|
|
|
|
Re: How to import external .jar and use it in a bundle [message #1709341 is a reply to message #1709327] |
Sun, 27 September 2015 03:08 |
|
Hi Lorenzo,
If you want to add a Non-OSGi library to your Eclipse Target Platform, you have to convert the Non-OSGi library to OSGi Bundle first and then you can put it in the dropins or plugins folder in Eclipse Installation Directory. Make sure to restart the IDE after you put the library in the respective folder. After the restart you would be able to use its exported packages.
Apart from it, you can manually create a folder anywhere and put the respective OSGi Library inside the folder and then you can add that directory to your target platform from Eclipse Preferences Dialog.
I would advise you to put the Non-OSGi Library in a specific folder inside your Bundle and put it in the Bundle Classpath. This will make your eclipse installation lightweight.
Thanks and Regards,
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
|
|
|
Re: How to import external .jar and use it in a bundle [message #1709751 is a reply to message #1709341] |
Wed, 30 September 2015 17:03 |
joseph muscolino Messages: 11 Registered: July 2015 |
Junior Member |
|
|
Hi to all.
I'd like to add to this discussion bacause i ran into a similar trouble. i've followed the first advice of Amit and i tried to add more external jars building a new bundle (org.eclipse.kura.lib_HTTP) and adding it to the main bundle (org.eclipse.kura.example.clientFIX). I'm trying to do a simple Http request.
I hope to help you to understand better by posting my screens.
Any advice?
Thanks in advance.
[Updated on: Thu, 01 October 2015 14:20] Report message to a moderator
|
|
|
Re: How to import external .jar and use it in a bundle [message #1709784 is a reply to message #1709751] |
Thu, 01 October 2015 06:13 |
|
Hi Joseph,
As you have already provided all necessary source code, I can see that in your build.properties file there are two warnings. I would advise you to correct them first. Secondly, the exception says that your HTTP Consumer Bundle can't be resolved as it has a missing dependency. It can't find org.apache.http package as it has to import this package to resolve consumer bundle. You have to install the bundle to your OSGi container which exposes the respective package (org.apache.http). After you install the bundle, start it so that your consumer bundle can import its relevant packages for resolution.
N.B: If you have already installed the apache http bundle, make sure it's started. Sometimes you can even confront that dependency bundles are not even started as those might need other dependencies for resolution. In such scenario, you have to install those needed dependencies as well.
Thanks and Regards,
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
[Updated on: Thu, 01 October 2015 06:16] Report message to a moderator
|
|
|
|
|
|
Re: How to import external .jar and use it in a bundle [message #1710128 is a reply to message #1710008] |
Sun, 04 October 2015 20:08 |
|
Hi Joseph,
Basically you have two ways to update your bundles.
1. You can use Kura's OSGi console to update the modified bundles
2. You can use Kura WebConsole to update the deployment package which comprises the modified bundles
For both the scenarios, you don't need to restart Kura and your changes should be reflected as well.
I am not sure what exactly happened to your Kura Installation which caused such trouble.
Thanks and Regards,
Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05329 seconds