felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre De Rop <pierre.de...@gmail.com>
Subject Re: Felix DependencyManager with annotation/eclipse
Date Wed, 11 Jan 2012 10:55:28 GMT
Hello Mohica;

Regarding your second question,

if I understand correctly, you are trying to use an osgi bnd directive file
from maven, right ? Since the DM annotation API also contains a native bnd
plugin, then it is indeed possible to do this, and I think that the root
cause of the NoClassDefFoundError is that you don't have added a dependency
over the DM annotation plugin inside the maven-bundle-plugin, and when bnd
tries to load the DM plugin (thanks to the -plugin option), then it does
not find it because the dependency over
org.apache.felix.dependencymanager.annotation bundle is missing within the

I have tried the following which works fine for me (I don't use a separate
osgi.bnd file but I rather declare the "_plugin" option in the
maven-bundle-plugin pom xml element, but I think it's similar to that you
are doing). Notice that:
    - I use "_plugin" option from the maven-bundle-plugin instead of
"-plugin" bnd directive.
    - And since the DM annotation bnd plugin is invoked directly using the
_plugin option, then it is not needed anymore to
declare the DM maven bundle plugin, which is useless in this case.

Here it is:

                        <Bundle-Name>Apache Felix Dependency Manager
Annotation Sample</Bundle-Name>



                        <!-- Ask bnd to load/run our dependency manager bnd
annotation plugin -->

                      <!-- Add our DM annotation plugin in bndlib class
path, allowing bnd to be
                             able to instantiate our DM plugin ... -->


Regarding your first question, I will get back to you later (tomorrow if

Hope this helps;

On Tue, Jan 10, 2012 at 9:47 PM, Mohica Jasha <mohica.jasha@gmail.com>wrote:

> Hi,
> 1. I am trying to control the dependencies of a bundle using felix
> annotations as explained here:
> http://felix.apache.org/site/apache-felix-dependency-manager-using-annotations-quick-start.html
> If I build the jar file out of the example and through it into felix
> launcher, it works perfectly, However I would like to debug the bundle
> within eclipse, and I cannot launch the bundle.
> I tried so many ways but no luck. Any idea how I can debug the bundle
> within eclipse?
> 2. I slightly changed the pom file to include the osgi.bnd file and the
> "-plugin
> org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin;log=warn" line
> in the bnd file causes the following compilation error when I build the
> project/package using maven:
> [WARNING] Warning building bundle
> mypackage:mypackage.dm.testan2:bundle:1.0-SNAPSHOT : Instructions in
> Private-Package, or -testpackages that are never used:
> mypackage\.dm\.testan\.testan
> Classpath:
> Jar:.,Jar:osgi_R4_core,Jar:osgi_R4_compendium,Jar:org.apache.felix.dependencymanager.annotation,Jar:org.osgi.core,Jar:bndlib,Jar:maven-project,Jar:maven-settings,Jar:maven-model,Jar:plexus-utils,Jar:plexus-container-default,Jar:junit,Jar:classworlds,Jar:maven-profile,Jar:maven-artifact-manager,Jar:maven-repository-metadata,Jar:maven-artifact,Jar:wagon-provider-api,Jar:maven-plugin-registry,Jar:maven-plugin-api,Jar:json,Jar:.,Jar:org.apache.felix.dependencymanager.annotation-3.0.0
> [WARNING] Warning building bundle
> mypackage:mypackage.dm.testan2:bundle:1.0-SNAPSHOT : No sub JAR or
> directory org.apache.felix.dependencymanager.annotation-3.0.0.jar
> [ERROR] Error building bundle
> mypackage:mypackage.dm.testan2:bundle:1.0-SNAPSHOT : Problem loading the
> plugin: org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin
> exception: (java.lang.NoClassDefFoundError:
> org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin not found,
> parent:  org.codehaus.classworlds.RealmClassLoader@585976c2 urls:[]
> exception:java.lang.ClassNotFoundException:
> org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin)
> [ERROR] Error(s) found in bundle configuration
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error(s) found in bundle configuration
> Thanks,
> Mohica

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message