I'm trying to install a bundle via the bundle context and I'm getting a strange exception.

public class FileInstaller implements BundleActivator
{
private static final Logger LOGGER = LoggerFactory.getLogger(FileInstaller.class);

  private BundleContext bundleContext;

  public void start(BundleContext bundleContext) throws Exception
  {
    System.out.println("Starting system bundle");
    this.bundleContext = bundleContext;
  }

  public void stop(BundleContext bundleContext) throws Exception
  {
    System.out.println("Stopping system bundle");
  }

public void install(File bundle) throws BundleException, FileNotFoundException
  {
LOGGER.info("Attempting to install bundle(" + bundle.exists() + "): " + bundle.getAbsolutePath()); bundleContext.installBundle("file://" + bundle.getAbsolutePath(), new FileInputStream(bundle));
  }
}

13:39:20,187 INFO FileInstaller:39 - Attempting to install bundle(true): /home/jddunlap/hello-bundle/hello-bundle-0.0.1-SNAPSHOT.jar Could not create framework: org.osgi.framework.BundleException: Could not create bundle object.
org.osgi.framework.BundleException: Could not create bundle object.
        at org.apache.felix.framework.Felix.installBundle(Felix.java:2650)
        at org.apache.felix.framework.Felix.installBundle(Felix.java:2501)
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:150)
        at com.example.felix.FileInstaller.install(FileInstaller.java:40)
        at com.example.felix.FelixLauncher.run(FelixLauncher.java:69)
        at com.example.felix.FelixLauncher.main(FelixLauncher.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.NoSuchMethodError: org.apache.felix.framework.util.VersionRange.isFloorInclusive()Z at org.apache.felix.framework.util.manifestparser.RequirementImpl.convertToFilter(RequirementImpl.java:117) at org.apache.felix.framework.util.manifestparser.RequirementImpl.<init>(RequirementImpl.java:49) at org.apache.felix.framework.util.manifestparser.ManifestParser.convertImports(ManifestParser.java:429) at org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:159)
        at org.apache.felix.framework.ModuleImpl.<init>(ModuleImpl.java:243)
        at 
org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:1162)
        at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:81)
        at org.apache.felix.framework.Felix.installBundle(Felix.java:2593)
        ... 10 more

Cheers!
-John


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to