-
1. Re: How to import third-part libraries?
ffang May 18, 2010 4:50 AM (in response to walter.accantelli)Hi,
This error shows you didn't install OSGi bundle jar correctly which contain com.mongodb package.
IMHO install third party lib as separate OSGi bundle jar is a good practice in OSGi container, so that more bundles can use it.
Also you can put the third party lib(I don't recommand you to do it) in your OSGi bundle under certain folder, but you need add Class-Path OSGi header, also in this case you shouldn't add Import-Package header, as Import-Package will always try to look for the package from other bundles which export it.
You said you can't convert a jar to OSGi bundle, then what's the problem you encounter?
Freeman
-
2. Re: How to import third-part libraries?
walter.accantelli May 18, 2010 5:21 AM (in response to walter.accantelli)Thank you very much, I solved.
Just remove the line from pom.xml
<Import-Package>
...
com.mongodb;version="1.4",
...
</Import-Package>
and follow the instruction to convert a simple jar (in my case, mongo-db.jar) into a osgi bundle (mongo-db.bar) as described in fuse documentation, Chapter 5: Deploying a JAR Library (below the instructions I follow).
-
Download bnd.jar from http://www.aqute.biz/Code/Download#bnd
(this generate mongo-db-1.4.bar)
java -jar bnd.jar wrap mongo-db-1.4.jar
(deploy mongo-db-1.4.bar bundle)
cp mongo-db-1.4.bar $FUSE_HOME/deploy
$ osgi:list
My Bundle That Use MongoDB (0.1)
-
Thank you very much.
walter
Edited by: walter.accantelli on May 18, 2010 9:20 AM
Edited by: walter.accantelli on May 18, 2010 9:21 AM