Question

I am trying to use eclipse's CDT for generating an AST for some cpp files. I am following the instructions given here: http://wiki.eclipse.org/images/c/c7/CDT_APIs_for_code_introspection.pdf

However, I ran into an error saying:

Exception in thread "main" java.lang.IllegalStateException: Workspace is closed.
at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:399)
at etl.CppParser.Parser(CppParser.java:23)**

After googling about it for a while, I understood that in order to access a project in the workspace (using ResourcesPlugin.getWorkspace().getRoot().getFile(path);), the project should be a plugin project, but my project was a simple Java project.

Therefore, I started to developed a plugin project in eclipse. I created a target platform to which I added all the required plugin dependencies required for my project. But I still have a problem when I run the plugin project as an Eclipse application. Here is the exact error:

!ENTRY org.eclipse.cdt.launch.remote 4 0 2013-11-30 01:43:27.379
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.launch.remote [300]
  Unresolved requirement: osgi.wiring.bundle; filter:="(&(osgi.wiring.bundle=org.eclipse.rse.ui)(&(bundle-version>=3.0.0)(!(bundle-version>=4.0.0))))"
    at org.eclipse.osgi.container.Module.start(Module.java:424)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1530)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1509)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1481)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1424)
    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)
Caused by: org.osgi.service.resolver.ResolutionException: Unable to resolve osgi.identity; osgi.identity="org.eclipse.cdt.launch.remote"; type="osgi.bundle"; version:Version="2.4.0.201309180223"; singleton:="true": missing requirement osgi.wiring.bundle; filter:="(&(osgi.wiring.bundle=org.eclipse.rse.ui)(&(bundle-version>=3.0.0)(!(bundle-version>=4.0.0))))"
    at org.apache.felix.resolver.Candidates.populateResource(Candidates.java:285)
    at org.apache.felix.resolver.Candidates.populate(Candidates.java:153)
    at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:147)
    at org.eclipse.osgi.container.ModuleResolver$ResolveProcess.resolve(ModuleResolver.java:652)
    at org.eclipse.osgi.container.ModuleResolver.resolveDelta(ModuleResolver.java:75)
    at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:454)
    at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:412)
    at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:402)
    at org.eclipse.osgi.container.Module.start(Module.java:406)
    ... 7 more
Root exception:
org.osgi.service.resolver.ResolutionException: Unable to resolve osgi.identity; osgi.identity="org.eclipse.cdt.launch.remote"; type="osgi.bundle"; version:Version="2.4.0.201309180223"; singleton:="true": missing requirement osgi.wiring.bundle; filter:="(&(osgi.wiring.bundle=org.eclipse.rse.ui)(&(bundle-version>=3.0.0)(!(bundle-version>=4.0.0))))"
    at org.apache.felix.resolver.Candidates.populateResource(Candidates.java:285)
    at org.apache.felix.resolver.Candidates.populate(Candidates.java:153)
    at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:147)
    at org.eclipse.osgi.container.ModuleResolver$ResolveProcess.resolve(ModuleResolver.java:652)
    at org.eclipse.osgi.container.ModuleResolver.resolveDelta(ModuleResolver.java:75)
    at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:454)
    at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:412)
    at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:402)
    at org.eclipse.osgi.container.Module.start(Module.java:406)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1530)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1509)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1481)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1424)
    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)

Could someone please tell me what I could do to get rid of this problem... I am not able to understand what the problem is at this point.

Thank you very much for any help.

Was it helpful?

Solution 2

The error says that bundle org.eclipse.cdt.launch.remote has a Require-Bundle (osgi.wiring.bundle) statement which lists bundle org.eclipse.rse.ui and the bundle version range [3.0,4.0). So org.eclipse.cdt.launch.remote cannot resolve because it is dependent on bundle org.eclipse.rse.ui having bundle version >=3 and < 4.

OTHER TIPS

Okay, I have solved the problem myself. What I did is as follows: I found this link for Target Management related Downloads and I downloaded the RSE runtime 3.2.2 (it is >=3 and <4)

http://download.eclipse.org/tm/downloads/

Then I went to Eclipse Windows->Preferences->Plugin Development->Target Platform , then selected my Target Platform->Edit-> Add->Directory and add the directory obtained by extracting the downloaded RSE runtime 3.2.2.zip.

After this, when I ran my plug in project as an Eclipse Application, I had no errors anymore because now, the plugins used by my plugin project do not have any unresolved dependencies.

I hope this helps someone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top