2

I am trying to migrate our bnd(OSGI) project from java 8 to 9. After first fail i have prepared basic project. However, I got stuck in problems with java versions capability, exacly like bellow (just a part of them, but all are the same with difference to the java version):

! Failed to start bundle org.apache.felix.gogo.command-1.0.2, exception 

Could not resolve module: org.apache.felix.gogo.command [12]
  Unresolved requirement: Import-Package: org.apache.felix.service.command; version="[1.0.0,2.0.0)"
    -> Export-Package: org.apache.felix.service.command; bundle-symbolic-name="org.apache.felix.gogo.runtime"; bundle-version="1.0.0"; version="1.0.0"
       org.apache.felix.gogo.runtime [2]
         Unresolved requirement: Import-Package: org.osgi.service.event; version="[1.3.0,2.0.0)"; resolution:="optional"
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

org.osgi.framework.BundleException: Could not resolve module: org.apache.felix.gogo.command [12]
  Unresolved requirement: Import-Package: org.apache.felix.service.command; version="[1.0.0,2.0.0)"
    -> Export-Package: org.apache.felix.service.command; bundle-symbolic-name="org.apache.felix.gogo.runtime"; bundle-version="1.0.0"; version="1.0.0"
       org.apache.felix.gogo.runtime [2]
         Unresolved requirement: Import-Package: org.osgi.service.event; version="[1.3.0,2.0.0)"; resolution:="optional"
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

First what I have done was update all dependencies - didn't help though. I have googled a lot, but with just a few links resulted. The one which was the closest to the problem didn't help thought - I have added following lines, without result:

run.bndrun

Bundle-RequiredExecutionEnvironment: JavaSE-9
Provide-Capability: osgi.ee;osgi.ee="JavaSE";version:List="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,9"

Maybe upgrade my bnd gradle plugin would help, however the version (I am currently using 3.5) mentioned (4.0) at readme is not available in mavenCentral.

My project specification - basic example repo

Eclipse Oxygen.3a Release (4.7.3a)
Bndtools 3.5.0.REL
Java 9.0.4+11
OSGI 6.0
Gradle 4.4
Gradle bnd plugin - 3.5

BTW: If you are trying to run project in Intellij, problems can occur - at least we didn't cope to run our main project.

Any help would be appreciated, I will do my best to provide you more info if required.

Update

Even when i delete nearly all dependencies (cleaned branch), after launch run.bndrun I am receiving only

could not resolve the bundles: [project.main-1.0.0.201804171613 org.osgi.framework.BundleException: Could not resolve module: project.main [3]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"

]

Failed to start bundle project.main-1.0.0.201804171613, exception Could not resolve module: project.main [3]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"

project.main is my only bundle.

Witold Kupś
  • 524
  • 7
  • 14

2 Answers2

3

Bnd 4.0 is not yet released. So it is not in maven central currently.

Also, you need to make sure the version of the Felix framework understands Java 9 and can properly provide the Java 9 ee.

BJ Hargrave
  • 9,324
  • 1
  • 19
  • 27
  • 1) thx for the first answer - I was [this issue](https://github.com/bndtools/bnd/issues/2420#issuecomment-381989171) author.:) 2) It can be the reason, however even my own bundle complained about java 8 ... About felix - i have checked `org.apache.felix.gogo` - at least [maven](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.gogo.runtime/1.0.12) is quite new... but I couldn't find any info about java 9 support though. Nevertheless, thx for the tip. – Witold Kupś Apr 17 '18 at 15:23
  • Ok, I have found that Karaf is using felix, even they have recently updated to the [newest version](https://github.com/apache/karaf/commit/9e550d8a654a08eae6ae487578bec8d545b1f6db). Also, Karaf is working on java 9 - [maybe not direct proof](http://karaf.922171.n3.nabble.com/Using-Karaf-with-Java-9-td4048910.html) but always... To say more, at [main page](http://felix.apache.org/documentation/subprojects/apache-felix-gogo.html) felix creators says, that ie. Eclipse depends on felix so... – Witold Kupś Apr 17 '18 at 15:37
  • I am talking about the Felix OSGi framework not the Felix gogo bundles. – BJ Hargrave Apr 18 '18 at 08:14
  • I was wandering "what are you talking to me" because we don't have dependency to `felix osgi` - we are using implementation included in [enroute](https://mvnrepository.com/artifact/org.osgi/osgi.enroute.pom.distro/2.0.0) - which uses `org.eclipse.osgi` in version 3.10 - 2015 year. I have updated manualy to [3.13](https://mvnrepository.com/artifact/org.eclipse.tycho/org.eclipse.osgi/3.13.0.v20171204-1916) - at least [basic example](https://github.com/Azbesciak/Java9OsgiMigration/tree/mini-no-own-dep) works now. – Witold Kupś Apr 18 '18 at 12:10
2

As i mentioned in a comment we have dedpendency to enroute 2.0, which provides old version of org.eclipse.osgi. After manual update to 3.13 problems with Require-capability have disappeared.

Witold Kupś
  • 524
  • 7
  • 14