0

I'm using eclipse mars 4.5.2 for mac OS X 10.11. I create a simple OSGi bundle project and it is missing osgi.core.jar in its classpath.

The import org.osgi cannot be resolved

mac-mars classpath screenshot

BUT When I do the same actions in eclipse luna 4.4.2 on windows with websphere classic - osgi.core.jar is on its place.

windows-luna classpath screenshot

What I need to do, to resolve OSGi dependency?

On mac I have the latest ibm websphere liberty developer tools for mars and liberty javaee7 8.5.5.9 (18.03.2016), may be its a bug?

UPD: my manifest on both bundles:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: IgLoginBundle
Bundle-SymbolicName: IgLoginBundle
Bundle-Version: 1.0
Bundle-Activator: activator.Activator
Import-Package: org.osgi.framework
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: activator

(I'm new to OSGi and just trying to implement a custom user registry for liberty)

Alex Torson
  • 289
  • 4
  • 13
  • The error says you have an `Import-Package` that includes `org.osgi`, but there is no such package, there are only subpackages of `org.osgi`, and you need to explicitly list all subpackages (not JARs). What does your MANIFEST.MF look like? – Brett Kail Apr 05 '16 at 12:55
  • @BrettKail added manifest, the error appears on lines: import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; – Alex Torson Apr 05 '16 at 13:03
  • Can you show the error? – Brett Kail Apr 05 '16 at 13:10
  • @BrettKail https://psv4.vk.me/c615330/u248178802/docs/2f34a37465f4/Snimok_ekrana_2016-04-05_v_16_17_53.png?extra=r5xRBD05-qn4c9y_vwhyARGyDq0kf68TvPsRRo7de-dpylfZoDhoBriiF0JIw_fHJ6KNpolguSIyWLx-Pi_gekt3geLUD3GeavQoaIbU1jNnZbkI8_PphknkrxqAU5Z_iYI5Htidna8aLnE – Alex Torson Apr 05 '16 at 13:22
  • That link doesn't work for me. – Brett Kail Apr 05 '16 at 14:16
  • @BrettKail http://i.imgur.com/uuMDj9q.png – Alex Torson Apr 05 '16 at 14:20
  • What happens if you click the "Add import to bundle manifest" button on that hover? It appears Eclipse doesn't think the Import-Package in your manifest contains org.osgi.framework. Perhaps you're editing the wrong file? – Brett Kail Apr 05 '16 at 17:38
  • @BrettKail if I click it, it do nothing with manifest file, the osgi.jar and/or osgi.core.jar is missing in bundle project classpath, in win+was classic the osgi.jar IS in classpath (see screenshot 2). The problem is that eclipse or developer tools on mac cant find and/or add osgi.jar to classspath – Alex Torson Apr 06 '16 at 05:53

1 Answers1

0

I have the latest ibm websphere liberty developer tools for mars and liberty javaee7 8.5.5.9 (18.03.2016)

I think the issue is the version of Liberty you are using. The EE7 edition does not come with the OSGi feature you needed by default.

Try to install the Liberty Profile V8.5.5.9 with OSGi Application. You should be able to download it via IBM WebSphere Liberty developer tools for Mars from the eclipse server view.

enter image description here

Abelard Chow
  • 598
  • 1
  • 5
  • 12
  • OP said they were trying to write a custom user registry, not an OSGi application. – Brett Kail Apr 05 '16 at 17:36
  • In order to build a CUR in Liberty, user need to create a bundle and feature (https://developer.ibm.com/wasdev/docs/creating-a-custom-user-registry-as-a-liberty-user-feature/). And this is what OP said "I create a simple OSGi bundle project" – Abelard Chow Apr 05 '16 at 21:03
  • Yes, an OSGi bundle, not an OSGi application. Why would OP need to download a Liberty runtime with OSGi application support just to build basic OSGi bundles? – Brett Kail Apr 05 '16 at 22:36
  • @Alex, please give the answer a try an let us know if the problem is resolved. Thanks – Abelard Chow Apr 06 '16 at 02:41
  • AbelardChow, @BrettKail, It solved the problem of missing jar! thank you! Now the com.ibm.ws.org.osgi.core.4.2.0_1.0.12.jar is in Plud-in dependencies section. – Alex Torson Apr 06 '16 at 07:00
  • AbelardChow, @BrettKail wow wow, now I deleted wlp-osgi-8.5.5.9 from mac, and in eclipse set Plug-in Development -> Target Platform -> wlp-8.5.5.9 and osgi.jar linked from /wlp-8.5.5.9/dev/spi/spec/com.ibm.wsspi.org.osgi.core.6.0.0_1.0.12.jar, seems like a bug of devtools – Alex Torson Apr 06 '16 at 11:30