Search code examples
javaeclipseeclipse-rcpheadless-rcp

The bundle XYZ could not resolved. Reason: Missing Constraint: Import-Package: ABC; version="1.0.0" error in headless RCP standalone


I'm working on standalone headless RCP. It works without problem when I execute the application and product in eclipse IDE, but when I export and execute it, I got this error in the log file.

enter image description here

!ENTRY org.eclipse.equinox.ds 4 0 2013-01-16 13:27:59.132
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.ds_1.4.0.v20120522-1841 [3]" could not be resolved. Reason: Missing Constraint: Import-Package: org.eclipse.equinox.internal.util.event; version="1.0.0"
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
...

!ENTRY org.eclipse.equinox.ds 4 0 2013-01-16 13:28:00.901
!MESSAGE [SCR] Exception while activating instance org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngineManager@6b8d6157 of component org.eclipse.e4.ui.css.swt.theme  
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Display
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)

Referring from this post, I understand that I've got a newer version of a plug-in without its dependencies, and there is something wrong in the runtime path. However, I'm not sure exactly what might cause this error.

What might be wrong? Why I have this error only when I execute it as standalone?

ADDED

I have build.properties file

output.. = bin/
bin.includes = META-INF/,\
               plugin.xml,\
               .
source.. = src/

This is MANIFEST.MF file

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Refactorer
Bundle-SymbolicName: edu.utexas.seal.refactorer;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: edu.utexas.seal.refactorer.Activator
Bundle-Vendor: PROSSEEK
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
 org.eclipse.jdt;bundle-version="3.8.0",
 org.eclipse.jdt.core;bundle-version="3.8.2",
 org.eclipse.core.resources;bundle-version="3.8.1",
 org.eclipse.text;bundle-version="3.5.200",
 org.eclipse.jdt.ui;bundle-version="3.8.1",
 org.eclipse.jdt.core.manipulation;bundle-version="1.5.0",
 org.eclipse.ltk.ui.refactoring;bundle-version="3.7.0",
 org.eclipse.jdt.core.manipulation;bundle-version="1.5.0",
 org.eclipse.ltk.core.refactoring;bundle-version="3.6.0",
 org.eclipse.jface.text;bundle-version="3.8.1",
 org.eclipse.core.expressions;bundle-version="3.4.401",
 org.eclipse.core.externaltools;bundle-version="1.0.100",
 org.eclipse.jface;bundle-version="3.8.101",
 edu.utexas.seal.utilities;bundle-version="1.0.0",
 org.eclipse.core.filebuffers;bundle-version="3.5.200"
Bundle-ClassPath: .
Export-Package: edu.utexas.seal.refactorer

I have only one item: "." in Bundle-ClassPath.


Solution

  • Missing org.eclipse.equinox.util

    I recompiled the project first, and then checked I have all the required plugins from the complaints in the log file, and then I found that I was missing the org.eclipse.equinox.util, I guess it should have been included automatically. After the including, some of the errors are just gone and I found that I have two more errors.

    enter image description here

    The execution environment issue

    I setup the "Execution Environment" as JavaSE-1.5, and this was an issue as the Java couldn't recognize @Override to cause the 'Must Override a Superclass Method' errors.

    enter image description here enter image description here

    I got a hint from this site.

    'Must Override a Superclass Method' Errors after importing a project into Eclipse

    Runtime level

    I also had to change the /ECLIPSE/configuration/config.ini file.

    osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:
    start,org.eclipse.equinox.ds@3 <-- (From 2 to 3) 
    :start,org.eclipse.core.runtime@start
    

    I don't know whether it's eclipse bug or not, I got a hint from this site.

    Some tips that I found useful

    • -consoleLog was really useful, as I didn't have to open the log file all the time.
    • This article gave me some direction how to solve the issue.
    • I guess once the eclipse RCP is working on eclipse IDE as a product, we should get working standalone RCP. If not, the issues should be configuration issues that make difference between IDE and standalone.