Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Problems when DS are referencing org.eclipse.core.resources
Problems when DS are referencing org.eclipse.core.resources [message #1758789] Mon, 03 April 2017 07:23 Go to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
Hey guys,

sometimes we have declarative services where we want to reference classes of org.eclipse.core.resources (e.g. IProject) in the service interface.

If we do this, this leads to the following exception in our application:

!ENTRY com.logicals.ptk 2 0 2017-04-03 08:48:59.652
!MESSAGE [SCR] Exception occurred while getting method 'register' of class com.logicals.ptk.logging.PlatformToolkitLoggerRegistry 
	Details:
	Problematic reference = Reference[name = PlatformToolkitLoggerFactory, interface = com.logicals.ptk.logging.PlatformToolkitLoggerFactory, policy = dynamic, cardinality = 1..n, target = null, bind = register, unbind = unregister]
	of service component = com.logicals.ptk.RegisterPTKLoggerRegistry
	component implementation class = com.logicals.ptk.logging.PlatformToolkitLoggerRegistry
	located in bundle with symbolic name = com.logicals.ptk
	bundle location = reference:file:plugins/com.logicals.ptk_1.98.0.201704022143.jar
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/core/resources/IProject
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.getDeclaredMethod(Class.java:2128)
	at org.eclipse.equinox.internal.ds.model.ComponentReference.getMethod(ComponentReference.java:104)
	at org.eclipse.equinox.internal.ds.model.ComponentReference.bind(ComponentReference.java:331)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference(ServiceComponentProp.java:444)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bind(ServiceComponentProp.java:218)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:343)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
	at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473)
	at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217)
	at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816)
	at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783)
	at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)


Is there a way to tell our application that org.eclipse.core.resources has to be loaded, before the declarative services are loaded and registered?


Thanks for any help! =)
Re: Problems when DS are referencing org.eclipse.core.resources [message #1759427 is a reply to message #1758789] Tue, 11 April 2017 07:45 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

.core.resources is lazily activated, so you shouldn't need to do anything. A java.lang.NoClassDefFoundError usually indicates that either you're missing a Require-Bundle, or there was a problem activating org.eclipse.core.resources. If the latter, there should be an error in the log.

Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Problems when DS are referencing org.eclipse.core.resources [message #1768160 is a reply to message #1759427] Fri, 14 July 2017 08:47 Go to previous messageGo to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
Hi Brian,

yes there is an error in the log:


Caused by: java.lang.IllegalStateException: The instance data location has not been specified yet.
	at org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized(DataArea.java:54)
	at org.eclipse.core.internal.runtime.DataArea.getStateLocation(DataArea.java:124)
	at org.eclipse.core.internal.runtime.InternalPlatform.getStateLocation(InternalPlatform.java:539)
	at org.eclipse.core.runtime.Plugin.getStateLocation(Plugin.java:289)
	at org.eclipse.core.internal.resources.LocalMetaArea.<init>(LocalMetaArea.java:59)
	at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:459)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:779)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:772)
	... 101 more


Can we do something about that? At the time we are always avoiding to use IResource and IProject and so on in our Declarative Services, but I think this is not the solution, right?
I think there has to be some other solution.

Thank you for your help. =)


Re: Problems when DS are referencing org.eclipse.core.resources [message #1768254 is a reply to message #1768160] Sun, 16 July 2017 02:09 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

You'll need to figure out why your service is being activated. You can post your service .xml file. Better yet is to put a breakpoint in your constructor and see what's on the stack.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:JDK installed to ram drive causing build errors
Next Topic:Search improvement project
Goto Forum:
  


Current Time: Sat Sep 22 20:31:06 GMT 2018

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

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

Back to the top