JDT's JavaCore class not seeing JavaModelManager in OSGi environment

Dear Knime developers and users!

I'm implementing plugin for Knime and I have some problem.
My plugin used library (let say lib A.jar), which normally is a eclipse plugin (however there are also classes for normal, standalone use). This lib A uses JDT Core classes.
When I'm executing my plugin's logic in IntelliJ IDEA (JDT is manually added to build path), everything is ok.

I have strange error while executing plugin in Knime environment. Library A see JDT JavaCore and JavaModelManager classes, however it seems that... JavaCore class is not seeing JavaModelManager class. Here is an exception which is raised:


java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jdt.internal.core.JavaModelManager
    at org.eclipse.jdt.core.JavaCore.getOptions(JavaCore.java:3927)
    at org.eclipse.jdt.core.dom.ASTParser.initializeDefaults(ASTParser.java:284)
    at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:234)
    at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java:129)
    at co.edu.unal.colswe.changescribe.core.ast.JParser.<init>(JParser.java:56){

I have tries various changes to fix this issue, however I'm new in OSGi, maybe I don't know about something.
My MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ic-depress-mg-rclinker
Bundle-SymbolicName: org.impressivecode.depress.mg.rclinker;singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-Vendor: ImpressiveCode
Require-Bundle: org.knime.base;bundle-version="2.8.0",
 org.knime.workbench;bundle-version="2.8.0",
 org.impressivecode.depress.base;bundle-version="1.0.0",
 org.impressivecode.depress.support.matcher;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: plugin.jar,
 (other libs),
 lib/eclipse/org.eclipse.core.resources_3.10.1.v20150725-1910.jar,
 lib/eclipse/org.eclipse.jdt.core_3.11.1.cs.jar,
 lib/eclipse/org.eclipse.core.runtime_3.11.1.v20150903-1804.jar
Eclipse-BuddyPolicy: registered

It seems that JavaCore class doesn't see JavaModelManager class.

I know, that this is probably not an issue in Knime, but maybe you've got similar issues?

Could you please help me?

 

If you already have an OSGi bundle why do you include it as a normal Jar file? This will almost certainly fail. Simply declare a dependency instead.

I'm now importing Eclipse Resources and Eclipse Runtime (Require-Bundle). I'm also thinking about requiring JDT Core.

 

In meantime I've asked this question also on StackOverflow and one user suggested, that there's probably an error while initializing this class. After checking - he was right. My plugin didn't see Knime's workspace. After fixing that (just adding Require-Bundle to Eclipse Resource plugin), this error is solved.

 

That you thor for your answer, it's also helpful :) I'm new in OSGi, so any advices are always helpful