Hello list,

I get the feeling what's happening to my code is a simple oversight but
I can't figure it out.

I've been adding more separation to my code by turning all the libraries
into bundles and by creating a bundle of my own with common code in it.
I have a tool in its own bundle that depends on this common code. When I
run it I get this error:

Caused by: java.lang.NoSuchFieldError: SCHEDULER
        at nl.redsocks.farm.analyzer.core.Analyzer.start(Analyzer.java:260)
        at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)

Line 260 says this:

Tools.SCHEDULER.scheduleAtFixedRate(this.fileUploader, 0,
config.general.sleep);

The nl.redsocks.farm.common.app.Tools class contains this:

public static final FarmTimer SCHEDULER = new FarmTimer();

These are the relevant bundles in the list:

karaf@root()> list
START LEVEL 100 , List Threshold: 50
 ID | State    | Lvl | Version   | Name

-----------------------------------------------------------------------------
 64 | Resolved |  80 | 1.0.143   | Analyzer

 92 | Active   |  80 | 1.00.07   | Farm-Common


The relevant exports for the Farm-Common bundle:

karaf@root()> package:exports | grep farm
nl.redsocks.farm.common.app                                 | 0.0.0
| 92  | nl.redsocks.farm.common

The Analyzer bundle imports this package:

karaf@root()> package:imports | grep analyzer
(&(osgi.wiring.package=nl.redsocks.farm.common.app))
                                             |          | 64  |
nl.redsocks.farm.analyzer                 | true

All code compiles normally without errors.

Where did I go wrong?

thnx, Jurgen

Reply via email to