Start an osgi bundle failed with Require-Bundle: org.eclipse.core.runtime; bundle-version="0.0.0" - eclipse

I'm trying to install and load an external bundle to a simple equinox application.
The targeted bundle is coming from a set of plugins for eclipse available here:
http://sourceforge.net/projects/rodin-b-sharp/files/Core_Rodin_Platform/2.4/ (rodin-2.4-dev.zip).
When I start equinox:
$ java -jar org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar -console
I can install it
osgi> install file:///path_to/rodin-2.4-dev/org.eventb.core_2.4.0.r14093.jar
Bundle id is 1
But I have an exception when I start it:
osgi> start 1
org.osgi.framework.BundleException: The bundle "org.eventb.core_2.4.0.r14093 [1]"
could not be resolved. Reason: Missing Constraint: Require-Bundle:
org.eclipse.core.runtime; bundle-version="0.0.0"
Does anyone know how to fix this error ?
Maybe it is related to the fact that the bundle does not include a org.eclipse.core.runtime version, as MANIFEST.MF has the following Require-Bundle:
Require-Bundle: org.eclipse.core.runtime,org.rodinp.core;visibility:=r
eexport,org.eventb.core.ast;visibility:=reexport,org.eventb.core.seqp
rover;visibility:=reexport

The bundle has a requirement to the runtime core as you have noticed. The install just installs the bundle, it does not mean it is valid. You can check the state of the bundle through diag command, i.e, osgi> diag 1
It needs to be in state resolved to be runnable. I'd bet it is just in state installed for you. Check Dude, where's my bundle for more info on bundles and their states.

Related

Liferay unresolve requirement: Import package

I have a module in 7.2 Liferay environment, in the modules folder. I've compiled everything by running the commands:
1 - blade gw jar inside the modules folder
2 - gradlew distBundle
3- gradle deploy
From there I get into the Tomcat directory and get the following error:
org.osgi.framework.BundleException: Could not resolve module: cuatroochenta.rest [1141] _ Unresolved requirement: Import-Package: com.liferay.asset.category.property.model; version = "[2.1.0,3.0.0)" _ [Sanitized]
I have been searching but the information it gives regarding the error is also not very clear and I have not found an explicit solution.
Any ideas ??
Thank you so much
add below lines in bnd.bnd file of your module :
Import-Package: \
!com.liferay.asset.category.*,\
!com.liferay.asset.category.property.*,\
*
Note:- need to add all those packages who show unResolved Requirement.

How to use Java11 (Java10) with Eclipse Plugin?

If I specify JavaSE-10 as minimum execution environment in my Eclipse plugin:
I get following errors when starting my plugin as Eclipse Application:
org.osgi.framework.BundleException: Could not resolve module: org.treez.core [597]
Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
Unresolved requirement: Require-Bundle: org.treez.javafxd3; visibility:="reexport"
-> Bundle-SymbolicName: org.treez.javafxd3; bundle-version="1.0.0.qualifier"; singleton:="true"
org.treez.javafxd3 [586]
Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
at org.eclipse.osgi.container.Module.start(Module.java:444)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.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)
I checked that
Java10 is reverenced under Installed JREs
10 is selected as compliance level
I use Oxygen.3a Release (4.7.3a) Build id: 20180405-1200
=>Is this a bug in eclipse equinox?
=>What else can I check to resolve this issue?
If I remove JavaSE-10 from the minimum execution environment settings I am able to start the Eclipse Application and the plugin seems to work fine.
When I export the plugin I get following warning:
# 25.04.18, 12:25:40 MESZ
# Eclipse Compiler for Java(TM) v20180330-0919, 3.13.102, Copyright IBM Corp 2000, 2015. All rights reserved.
option -bootclasspath not supported at compliance level 9 and above
When I try to use the plugin after installing it from my update page, I get a ClassNotFoundException:
...
Caused by: java.lang.ClassNotFoundException: org.treez.views.tree.TreeViewPart cannot be found by org.treez.views_1.0.0.201804191641
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
... 114 more
If I use Java8 everything works fine.
Related questions:
Java 8 & Missing required capability Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8))"
How to set up java 10 in Eclipse Oxygen?
How to add org.eclipse.swt (and other plugin dependencies) as an automatic Java9 module?
It looks like Eclipse OSGi does not support Java SE 10 yet. I downloaded the latest Eclipse Oxygen 4.7.3a and opened plugins/org.eclipse.osgi_3.12.100.v20180210-1608.jar. The last supported profile was JavaSE-9.
So, you have two choices here:
Wait until OSGi officially supports JavaSE-10 profile.
If you really want to write a plugin with Java 10 and you have control over the plugins folder (e.g. you develop an Eclipse RCP application), open the OSGI jar and add a new profile JavaSE-10. To do this, you can copy JavaSE-9.profile to JavaSE-10.profile and fix corresponding lines in the new file. Also, you must add a new line to profile.list.
Since OSGi 4.3, the most appropriate way to specify a minimum Java version is using the Required-Capability header, as in:
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=1.10))"
I have had success fixing the reported error by replacing all occurrences of Bundle-RequiredExecutionEnvironment with the above line. In PDE, you may get a warning on the manifest file, but it can be safely ignored. Product validation and product exports seems to work without issue.
The semantic of the BREE header required that an execution environnement descriptor be provided by the OSGi implementation for each specific release of the JRE. In Equinox, this used to be defined through ".profile" files; these profiles have been supported by Equinox up to JavaSE-9, but it has been announced that Equinox they would no longer provide profiles for newer releases of Java.
The Tycho community has handled this issue on their side by creating their own Java 10 profile, but it can't be used directly from PDE. The P2 community is considering copying Tycho's Java 10 profile, but this has been stalled for a long time. I'm not sure how P2 reacts at present when fed bundles that do not contains the BREE header.
What worked for me as a work around was to
Remove the required version entries from the manifest files and ignore the corresponding warnings
Activate the option "Use class files compiled in the workspace" in the export wizard:
(Therefore I assume that something goes wrong during the compilation step of the export wizard if that option is not applied.)
I used Java 11.0.1 and Eclipse SimRel 2018-09 (plus Java11 support plugin)

Eclipse RCP: Unresolved Requirement

I have two local plugin projects in eclipse, both maven projects.
AvgPowerTool
AvgPowerCommon
AvgPowerTool is dependent on AvgPowerCommon (It uses classes from AvgPowerCommon).
When I run the application and try to instantiate a class from AvgPowerCommon the application exits with an exception:
java.lang.RuntimeException: No application id has been found.
Above it, in the log I see:
!ENTRY org.eclipse.equinox.app 0 0 2015-06-02 12:08:10.113
!MESSAGE Product AvgPowerTool.product could not be found.
!ENTRY AvgPowerTool 2 0 2015-06-02 12:08:10.164
!MESSAGE Could not resolve module: AvgPowerTool [208]
Unresolved requirement: Require-Bundle: AvgPowerCommon
This is how the required plugins in AvgPowerTool's plugin.xml look:
What can I do to resolve this?
Thanks.
When running an RCP using 'Run > Eclipse Application' you need to make sure that all the required plugins are checked in the 'Run Configuration' for the application (on the Plugins tab).
If you subsequently build the RCP using an xxx.product file you must list all the required plugins (or features) in the product file.

Need bundle with javax.persistence on OSGi

I get this error when I try to install my bundle in Servicemix:
Error executing command: Error starting bundles:
Unable to start bundle 179: Unresolved constraint in bundle de.edigrid.edigrid-servicemix-util [179]: Unable to resolve 179.0: missing requirement [179.0] osgi.wiring.package; (osgi.wiring.package=javax.persistence)
Can anybody tell me if is there a standard jar file, OSGi compliant, that exports javax.persistence package?
Thanks.
Just install the jpa feature. If this feature is not available in your servicemix version then try:
install -s mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1
EclipseLinks has a bundle, it's included in their download: http://www.eclipse.org/downloads/download.php?file=/rt/eclipselink/releases/2.5.2/eclipselink-plugins-2.5.2.v20140319-9ad6abd.zip
Alternatively you can also get the same bundle from the Amdatu Dependencies repository: https://bitbucket.org/amdatu/amdatu-repository/src/53bb0dd92bcf005da5a6937c2034d366e9f21365/dependencies/javax.persistence/javax.persistence-2.0.3.jar?at=master#

The bundle could not be resolved in RCP-RAP application

I have a RCP application which constitutes of a number of plugins. And now, I try to develop RAP application which uses my old plugins. My RAP has a dependency of one old plugin. I created my own target platform and I added RAP sdk and other many eclipse platform libraries. When I run my RAP application, I get this exception. Do you have any idea to solve that? Depended plugin uses "org.eclipse.ui" package.
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Require-Bundle: org.unicase.link; bundle-version="1.0.0"
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1313)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1297)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:319)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1069)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:554)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:461)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:246)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:442)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337)
2009-12-02 01:13:23.625::WARN: ERROR: /rap
java.lang.IllegalArgumentException: An entry point named 'hello' does not exist.
at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:77)
at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:227)
at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:115)
at java.lang.Thread.run(Unknown Source)
at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:80)
It's failing because it can't load the org.unicase.link bundle. And the reason that it can't load that is probably a missing dependency in that bundle. So look in the manifest for that plugin and look at all of the dependent plugins and make sure they are all there. It should also have a list for the plugins that were not loaded for some reason in the log. One thing you can do is make all of the dependencies in the org.unicase.link bundle optional, which should get you further along.