Question

We are developing a Netbeans RCP application that includes NB modules, and OSGi modules. When running the developed RCP application, it gives a NoSuchMethodFoundException on ServiceTracker(ServiceTrackerCustomizer) constructor.

It is weird that when this application is packed as a .Zip distribution and extracted & executed from the .Zip package it works. Also, this application runs quite well on some machines(that have the same version and configuration) and it will give the same error on other machines.

Is there any solution for this? Did we make a mistake in RCP and OSGi config, or is this an Netbeans installation problem?

I have been inspecting this issue for a long time, and I haven't been able to find a solution for it.

Configuration:

Windows 8 x64 Netbeans 7.3 or 7.3.1 ( any of both versions )

Thanks...

Was it helpful?

Solution

An additional constructor was added to ServiceTracker in release 4.3 (the one which takes a java.lang.Class as its second argument). It's likely that you developed the bundle against a higher version of OSGi than is supported by NetBeans.

Normally this kind of error can be avoided with proper versioning. Your bundle should import the org.osgi.util.tracker package with version range [1.5,2.0) as follows:

Import-Package: org.osgi.util.tracker; version="[1.5,2.0)"

If NetBeans does not support OSGi R4.3 (I'm not aware myself whether it does or not) then you should develop against R4.2 and avoid the additional methods which were added in 4.3.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top