Search code examples
mavenosgiosgi-bundlekaraf

unable to start the bundle created using maven archetype in apache karaf


I tried to create an osgi bundle using apache karaf using maven archetype as mentioned in the karaf devlopers guide .

mvn archetype:generate \-DarchetypeGroupId=org.apache.karaf.archetypes \-DarchetypeArtifactId=karaf-bundle-archetype \-DarchetypeVersion=4.0.0 \-DgroupId=com.mycompany \-DartifactId=TestBundle \-Dversion=1.0.0-SNAPSHOT \-Dpackage=com.mycompany.newpkg

so i have a directory created TestBundle and then i did "mvn install" here . So the bundle (jar file) is created in the target folder . when i copy this folder on deploy , i see that it is installed , but on restarting i see this issue below

karaf@victoria>bundle:list | grep Test
396 | Installed   |  80 | 1.0.0.SNAPSHOT               | TestBundle Bundle
karaf@victoria>bundle:info 396

TestBundle Bundle (396)
-----------------------
karaf@victoria>bundle:restart 396
Error executing command: Error restarting bundles:
Unable to start bundle 396: The bundle "TestBundle_1.0.0.SNAPSHOT [396]"
    could not be resolved. Reason: Missing Constraint:
        Import-Package: org.osgi.framework; version="[1.8.0,2.0.0)"

My pom.xml import-package has nothing but a star. *

Manifest-Version: 1.0
Bnd-LastModified: 1446200540685
Build-Jdk: 1.8.0_51
Bundle-Activator: com.mycompany.newpkg.Activator
Bundle-Description: TestBundle OSGi bundle project.
Bundle-ManifestVersion: 2
Bundle-Name: TestBundle Bundle
Bundle-SymbolicName: TestBundle
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: com.mycompany.newpkg;version="1.0.0.SNAPSHOT";uses:="org
 .osgi.framework"
Import-Package: org.osgi.framework;version="[1.8,2)"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.5))"
Tool: Bnd-2.4.1.201501161923

Solution

  • The manifest says the bundle was compiled against (and expects at runtime) an OSGi Core R6 Framework (framework version 1.8). Does the version of Karaf you are using support OSGi Core R6?