Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Application does not start after adding an aditional OSGi declarative service.(After adding an OSGi declarative service that references an IResource )
Application does not start after adding an aditional OSGi declarative service. [message #1767367] Wed, 05 July 2017 10:05 Go to next message
Vladimir Jaksic is currently offline Vladimir JaksicFriend
Messages: 1
Registered: July 2017
Junior Member
I have a Problem with OSGi declarative services. I am referencing an IResource in my interface and therefore, the application suddenly fails to start with an error:
Caused by: java.lang.IllegalStateException: The instance data location has not been specified yet.

And
java.lang.NoClassDefFoundError: org/eclipse/core/resources/IResource. 


I have tried adding the org.eclipse.core.resources to the required bundles in the manifest, but to no avail. Any clues about bringing this about?

I have added the full exception trace to the attachments.
Re: Application does not start after adding an aditional OSGi declarative service. [message #1767394 is a reply to message #1767367] Wed, 05 July 2017 15:19 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

Referencing `IResource` isn't a problem in itself, but your service is being activated, causing the JVM to load the referenced class definitions, before the Eclipse workspace is available. `org.eclipse.core.resources`'s Bundle Activator tries to restore the workspace, which requires accessing the OSGi `osgi.instance.area` location, which has not yet been set.

It's hard to say more without knowing more about your declarative service. A few possible ways to avoid this issue include (1) using the IAdapter mechanism to avoid specifying IResource in your method signatures, (2) adding a dependency on the IWorkspace service (exposed by `org.eclipse.core.resources`) so that your service won't be available until the workspace has been started.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:eclipse lock jar files
Next Topic:Access restriction: The type 'String' is not API (restriction on required library '/opt/jdk1.7.0_51/
Goto Forum:
  


Current Time: Tue Sep 18 22:56:09 GMT 2018

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

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

Back to the top