Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Require-Bundle of org.eclipse.core.runtime causes failure at runtime(How can Require-Bundle fail when Import-Package works?)
Require-Bundle of org.eclipse.core.runtime causes failure at runtime [message #1239352] Tue, 04 February 2014 02:01 Go to next message
Ed Gow is currently offline Ed Gow
Messages: 8
Registered: July 2009
Junior Member
I'm still trying to get my Tycho build working on Eclipse 3.8. I read somewhere on the net that because org.eclipse.core.runtime is a split package, it was necessary to use Require-Bundle: org.eclipse.core.runtime instead of Import-Package: org.eclipse.core.runtime. Doing that did indeed fix my Tycho build. Unfortunately, it also breaks the application so that it fails to start both from the Tycho build product and also in the Eclipse IDE. The failure looks like:

!ENTRY org.eclipse.equinox.app 0 0 2014-02-03 17:53:11.924
!MESSAGE Product org.gems.core.ui.product could not be found.

!ENTRY org.gems.core.ui.application 4 0 2014-02-03 17:53:12.365
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: The bundle "org.gems.core.ui.application_1.0.0.qualifier " could not be resolved. Reason: Missing Constraint: Import-Package: org.gems.common.ui; version="[1.0.0,2.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)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.gems.core.ui.application 4 0 2014-02-03 17:53:12.703
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: The bundle "org.gems.core.ui.application_1.0.0.qualifier [144]" could not be resolved. Reason: Missing Constraint: Import-Package: org.gems.common.ui; version="[1.0.0,2.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)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.setBundleSL(StartLevelManager.java:670)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:435)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
osgi>

Changing absolutely nothing apart from removing the Require-Bundle and adding org.eclipse.core.runtime to the Import-Package: list in one single manifest file for org.gems.core fixes the problem and the RCP app runs fine in the IDE, but the Tycho build now will fail.

Can anyone advise about what I might be doing wrong here? I cannot understand how using Require-Bundle can cause a runtime failure when Import-Package for that bundle's export works fine. If there was a problem resolving the required bundle then the build should fail, right? Both PDE and Tycho builds succeed with the Reqire-Bundle, but both of the builds then fail at runtime. Can anyone suggest something I can try to resolve this?

[Updated on: Tue, 04 February 2014 18:51]

Report message to a moderator

SOLVED: Require-Bundle of org.eclipse.core.runtime causes failure at runtime [message #1276757 is a reply to message #1239352] Tue, 25 March 2014 01:32 Go to previous message
Ed Gow is currently offline Ed Gow
Messages: 8
Registered: July 2009
Junior Member
The package org.eclipse.core.runtime is a split package. The specific class being used by the problem bundle is org.eclipse.core.runtime.FileLocator, and that class is in the portion of the package exported by the org.eclipse.equinox.common bundle. When that one is imported using require-bundle then the application runs.

In the current case, it is important to use require-bundle instead of import-package because of a problem in Tycho. To build with Tycho, require-bundle should be used for split packages.

If no bundle which exports org.eclipse.core.runtime is required and the package is not imported, then the JDT reports the FileLocator class as missing. If the org.eclipse.core.runtime bundle, which does not contain the FileLocator class, is imported with require-bundle then JDT DOES NOT report the class as missing. I've filed bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=431068 for the failure to catch the missing class import in PDE/JDT.
Previous Topic:How to generate horizontal line at the end of folding sections?
Next Topic:[LTK Refactoring] Not Able to Move Package
Goto Forum:
  


Current Time: Sat Oct 25 01:31:36 GMT 2014

Powered by FUDForum. Page generated in 0.01675 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software