On 6/22/10 10:06 AM, Bertrand Delacretaz wrote:
> Hi Federico,
> 
> On Tue, Jun 22, 2010 at 3:33 PM, Federico Paparoni
> <[email protected]> wrote:
>> I'm creating a new bundle to test a servlet that manage a new extension.
>> I have dependency with iText and, obviously, when I try to deploy the bundle
>> I receive this error in log
>>
>> ...(org.osgi.framework.BundleException: Unresolved constraint in bun
>> dle david [64]: package; (package=com.itextpdf.text.pdf))
> 
>> ... What are the best practises in that case? Where I have to put the 
>> dependency
>> JAR?...
> 
> Best is to find an OSGi bundle that exports the required iText
> classes. Many Apache projects (like commons.a.o) now include the OSGi
> metadata in their standard jars, so you can just load them as bundles.
> 
> I don't know if that's the case for iText, searching "itext osgi
> bundle" on google should help find out if such bundles are available.
> Install the bundle (using OSGi console is the easiest for a quick
> test) , and check the OSGi console to see if it exports the packages
> that you need.
FWIW, there is bundle for iText in the SpringSource bundle repository:
http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.lowagie.text&version=2.0.8

Justin

> 
> If you cannot find an iText bundle, you could "OSGify" an existing
> iText jar using the bnd tool or the maven-bundle-plugin to add the
> required MANIFEST.MF information to it.
> 
> Last (and least optimal) solution is to embed the iText classes in
> your bundle using the Embed-Dependency option of the
> maven-bundle-plugin, see
> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
> 
> That last option might be the easiest for a quick test, the problem is
> that it adds bloat to your bundle and if another bundle needs those
> classes that would lead to duplication.
> 
> Hope this helps,
> -Bertrand

Reply via email to