osgicytoscape

OSGi: missing requirement osgi.wiring.package with local bundle


My first time using maven and OSGi. I write app for Cytoscape, which uses OSGi. My app requires SMT solver. Firstly, I built regular JAR, using binding from: github.com/SRI-CSL/yices2_java_bindings. Then used bnd to create OSGi bundle with the following text (in .bnd file):

-classpath: yices.jar
Bundle-SymbolicName: com.sri.yices
ver: 1.0.0
-output: ${bsn}.jar
Bundle-Version: ${ver}
Export-Package: *; version=${ver} 

MANIFEST.MF of SMT solver bundle:

Manifest-Version: 1.0
Bnd-LastModified: 1709709378499
Bundle-ManifestVersion: 2
Bundle-Name: com.sri.yices
Bundle-SymbolicName: com.sri.yices
Bundle-Version: 1.0.0
Created-By: 17.0.10 (Private Build)
Export-Package: com.sri.yices;version="1.0.0"
Require-Capability: osgi.ee;filter:="(osgi.ee=UNKNOWN)"
Tool: Bnd-5.0.1.202101211358

My app's pom.xml contents about maven-bundle-plugin:

<plugin>
 <groupId>org.apache.felix</groupId>
 <artifactId>maven-bundle-plugin</artifactId>
 <version>${maven-bundle-plugin.version}</version>
 <extensions>true</extensions>
 <configuration>
  <instructions>
   <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
   <Bundle-Name>BNwPAS</Bundle-Name>
   <Bundle-Version>${project.version}</Bundle-Version>
   <Private-Package>${bundle.namespace}.*</Private-Package>
   <Export-Package>!${bundle.namespace}.*</Export-Package>
   <Bundle-Activator>${bundle.namespace}.CyActivator</Bundle-Activator>
  </instructions>
 </configuration>
</plugin>

pom.xml file contents about smt solver dependency:

<dependency>
 <groupId>org.sri</groupId>
 <artifactId>yices</artifactId>
 <version>1.0.0</version>
 <scope>system</scope>
 <systemPath>${yices-systemPath}</systemPath>
</dependency>

MANIFEST.FM of project bundle:

Manifest-Version: 1.0
Bnd-LastModified: 1709972907550
Build-Jdk-Spec: 21
Bundle-Activator: org.veldalen.BNwPAS.internal.CyActivator
Bundle-ManifestVersion: 2
Bundle-Name: BNwPAS
Bundle-SymbolicName: org.veldalen.BNwPAS
Bundle-Version: 0.1
Created-By: Apache Maven Bundle Plugin 5.1.9
Import-Package: com.sri.yices;version="[1.0,2)",java.lang,java.util,or
 g.cytoscape.model;version="[3.10,4)",org.cytoscape.service.util;versi
 on="[3.10,4)",org.cytoscape.work;version="[3.10,4)",org.osgi.framewor
 k;version="[1.8,2)"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=17))"
Tool: Bnd-6.3.1.202206071316

When I try to start my app in Cytoscape, I get the following: Error starting bundle 127: Unable to resolve org.veldalen.BNwPAS [127](R 127.0): missing requirement [org.veldalen.BNwPAS [127](R 127.0)] osgi.wiring.package; (&(osgi.wiring.package=com.sri.yices)(version>=1.0.0)(!(version>=2.0.0))) Unresolved requirements: [[org.veldalen.BNwPAS [127](R 127.0)] osgi.wiring.package; (&(osgi.wiring.package=com.sri.yices)(version>=1.0.0)(!(version>=2.0.0)))] What am I missing?

I were expecting to have no wiring problems.


Solution

  • All third-party dependencies need to be embedded in the App jar file. (Cytoscape doesn't support multi-bundle apps, all dependencies not provided by the Cytoscape runtime have to be embedded in your App's jar file.)

    Here is an example: https://github.com/BaderLab/AutoAnnotateApp/blob/master/AutoAnnotate/pom.xml#L74-L89