Application does not start after adding an aditional OSGi declarative service. [message #1767367] |
Wed, 05 July 2017 06:05  |
Eclipse User |
|
|
|
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 11:19  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.04273 seconds