I have successfullly started an OSGi framework (Apache Felix). Now I was
trying to start and install and OSGi bundle. But as soon as I try starting
the OSGI bundle, I always get this below exception-

*    Unresolved constraint in bundle GoldenlseyeStorageService [1]: Unable
to resolve 1.0: missing requirement [1.0] osgi.wiring.package;
(&(osgi.wiring.package=com.host.kernel.logger)(version>=1.19.0)(!(version>=2.0.0)))
*

The company that I am working for they have made there own logger code
which is extending Apache Log4j. And this package `com.host.kernel.logger`
is coming from there jar file. Meaning my bundle is depending on this jar
maven dependency somehow. And I am not sure how can I fix the above
exception as it might be possible, I might need to depend on some other
maven dependency of our company specific that is stored in our own
repository.
 Below is my simple code which is starting the OSGi framewok and then
trying to install/start the bundle-

    import java.io.File;

    import org.apache.tomcat.util.http.fileupload.FileUtils;
    import org.osgi.framework.Bundle;
    import org.osgi.framework.BundleActivator;
    import org.osgi.framework.BundleContext;
    import org.osgi.framework.BundleException;
    import org.osgi.framework.launch.Framework;
    import org.osgi.framework.launch.FrameworkFactory;

    public class TestOSGi {

    public static void main(String[] args) {

    try {
    FileUtils.deleteDirectory(new File("felix-cache"));
    FrameworkFactory frameworkFactory =
ServiceLoader.load(FrameworkFactory.class).iterator().next();

    Framework framework = frameworkFactory.newFramework(new HashMap<String,
String>());
    framework.start();

    final BundleContext bundleContext = framework.getBundleContext();
    final List<Bundle> installedBundles = new LinkedList<Bundle>();

    BundleActivator b = new org.ops4j.pax.url.mvn.internal.Activator();
    b.start(bundleContext);

    String localFilename =
"file:C:\\Storage\\GoldenlseyeStorageService-1.0.0.jar";

    installedBundles.add(bundleContext.installBundle(localFilename));

    for (Bundle bundle : installedBundles) {
    bundle.start();
    }

    } catch (IOException e) {
    e.printStackTrace();
    } catch (BundleException e) {
    e.printStackTrace();
    } catch (Exception e) {
    e.printStackTrace();
    }

    }
    }
Below is the manifest file for my `GoldenlseyeStorageService` bundle that I
am trying to install-

    Manifest-Version: 1.0
    Bnd-LastModified: 1377333824248
    Build-Jdk: 1.6.0_26
    Built-By: rjamal
    Bundle-Description: Managed dependencies and plugins across all Raptor a
     pplications.
    Bundle-ManifestVersion: 2
    Bundle-Name: GoldenlseyeStorageService
    Bundle-SymbolicName: GoldenlseyeStorageService
    Bundle-Version: 1.0.0
    Created-By: Apache Maven Bundle Plugin
    Export-Package: com.host.domain.sharedpersonalize.storageservice;use
     s:="com.host.soaframework.common.exceptions,com.host.marketplace.servic
     es.storageservice,com.host.personalize.services.storage.consumer.ge
     n,com.host.personalize.services.storage.consumer,com.host.soaframew
     ork.sif.service,com.host.marketplace.services,com.host.kernel.logger";v
     ersion="1.0.0",com.host.marketplace.services.storageservice;uses:="java
     x.xml.bind.annotation,com.host.marketplace.services,javax.activation";v
     ersion="1.0.0",com.host.personalize.services.storage.consumer;uses:
     ="javax.xml.ws,com.host.marketplace.services.storageservice";version="1
     .0.0",com.host.personalize.services.storage.consumer.gen;uses:="com
     .host.soaframework.common.exceptions,com.host.personalize.services.
     storage.consumer,com.host.soaframework.sif.impl.internal.service,com.eb
     ay.soaframework.sif.service,javax.xml.ws,com.host.marketplace.services.
     storageservice,com.host.soaframework.common.types,com.host.soaframework
     .common.impl.internal.schema,javax.xml.namespace,com.host.soaframework.
     common.registration";version="1.0.0"
    Import-Package: com.host.kernel.logger;version="[1.19,2)",com.host.marke
     tplace.services;version="[1.7,2)",com.host.soaframework.common.exceptio
     ns;version="[1.4,2)",com.host.soaframework.common.impl.internal.schema;
     version="[1.4,2)",com.host.soaframework.common.registration;version="[1
     .4,2)",com.host.soaframework.common.types;version="[1.4,2)",com.host.so
     aframework.sif.impl.internal.service;version="[1.4,2)",com.host.soafram
     ework.sif.service;version="[1.4,2)",javax.activation,javax.xml.bind.ann
     otation,javax.xml.namespace,javax.xml.ws
    ServicesURLStrategyVersion: 1.0.0-RELEASE
    Tool: Bnd-1.50.0
    X-Raptor-Source-Dir:
S:\GitViews\GoldenlseyeStream\GoldenlseyeStorageServic

 e/src/main/webapp,S:\GitViews\GoldenlseyeStream\GoldenlseyeStorageService/

 src/main/resources,S:\GitViews\GoldenlseyeStream\GoldenlseyeStorageService


Can anyone help me with this?

Reply via email to