Thank you very much. Does this mean, I should not use 
org.osgi.core 4.2.0 in the Velocity Scripting bundle? We include
Felix Framework 3.0.2 which implements osgi 4.2. Shouldn't we
use org.osgi.core 4.2.0 in the parent pom as well?
Is there another way to get the BundleContext in a class which is created
by a class you cannot control?

best regards
mike

> >...I tried
> > to use FrameworkUtil.getBundle( getClass() ) inside this class.
> > So far so good. But when I try to compile the bundle with maven, I always
> > get "cannot find symbol" for FrameworkUtil.getBundle, but artifact
> org.osgi.core
> > is included in the pom.xml. And what's really confusing: if I try to call
> > FrameworkUtil.createFilter( "xy" ) I get no errors....
> 
> For the FrameworkUtil.getBundle(...) method you need org.osgi.core
> 4.2.0, and the Sling parent pom (which I assume is what you're using)
> uses 4.1.0.
> 
> -Bertrand
> 
> 
> P.S here's one way to find out about such things:
> 
> $  mvn dependency:copy-dependencies
> ...
> $ cd target/dependency/
> $ unzip org.osgi.core-4.1.0.jar
> $ javap -classpath . org.osgi.framework.FrameworkUtil
> Compiled from "FrameworkUtil.java"
> public class org.osgi.framework.FrameworkUtil extends java.lang.Object{
>     static java.lang.Class class$java$lang$String;
>     public static org.osgi.framework.Filter
> createFilter(java.lang.String)       throws
> org.osgi.framework.InvalidSyntaxException;
>     static java.lang.Class class$(java.lang.String);
> }
> 
> And if you do the same with a 4.2.0 core jar you see the getBundle method.

Reply via email to