0

I'm implementing plugin for Knime (eclipse-based analitics platform). 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.

Project is build with Maven Tycho plugin. Every other dependency is working ok, however they're normal jars.

Could you please help me?

T. Gawęda
  • 15,706
  • 4
  • 46
  • 61
  • 1
    That error means the class was found but could not be initialised - see http://stackoverflow.com/questions/1401111/noclassdeffounderror-could-not-initialize-class-error – greg-449 Jan 19 '16 at 17:45
  • 1
    You should add the eclipse bundles as `Require-Bundle` instead of `Bundle-ClassPath`. – Gábor Bakos Jan 19 '16 at 19:31
  • You are right! I don't know, how I missed that answer. Also second comment was very useful, because runtime and resources bundles I can get from Knime (JDT is not in Knime, so I must add it manually). Thank you very much for your help :) – T. Gawęda Jan 19 '16 at 20:47
  • 1
    @T.Gawęda You can add JDT to the target platform (http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Fpreference_pages%2Ftarget_platform.htm), so you can depend on them as bundles. – Gábor Bakos Jan 19 '16 at 21:41
  • @greg-449 could you please writer answer? You deserve upvote :) – T. Gawęda Oct 06 '16 at 18:49

0 Answers0