Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » Huge variety of ClassNotFoundExceptions trying to load P2 repositories(Using P2 as a standalone product with minimal set of bundles in restricted environment)
Huge variety of ClassNotFoundExceptions trying to load P2 repositories [message #1734287] Mon, 06 June 2016 19:00 Go to next message
Elias Vasylenko is currently offline Elias VasylenkoFriend
Messages: 19
Registered: December 2015
Junior Member
Hi, I hope someone can give me a few pointers here, I am trying to get a small tool working which can interact with P2 repositories. Due to certain constraints wrt how I can approach this, currently I'm getting a framework instance via FrameworkFactory and installing and starting a minimal set of bundles manually.

For the most part this seems to be working fine, and I have the framework & bundle class loaders configured so I can pull the query results back out of the framework and make them accessible in the host (non-OSGi) class loader, but under certain circumstances I'm getting a lot of confusing class loading errors when I try to invoke IMetadataRepositoryManager::loadRepository or IArtifactRepositoryManager::loadRepository, e.g:

java.lang.ClassNotFoundException: org.eclipse.equinox.internal.p2.engine.ProfilePreferences cannot be found by org.eclipse.equinox.p2.metadata.repository_1.2.200.v20150428-1613

java.lang.ClassNotFoundException: org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory cannot be found by org.eclipse.equinox.preferences_3.5.300.v20150408-1437

java.lang.ClassNotFoundException: org.eclipse.ecf.provider.filetransfer.identity.FileTransferNamespace cannot be found by org.eclipse.equinox.p2.artifact.repository_1.1.400.v20150513-2116


... and many more similar.

I've tried rearranging the bundle start order in all the different permutations I can think of, including based on the start levels of some existing eclipse products, but nothing seems to make a difference. I just end up with a bunch of slightly different class loading errors.

The only thing that I've found to work is adding the following bundles to the framework, after which all my unit tests magically start to pass:

...
	org.apache.felix.gogo.command,\
	org.apache.felix.gogo.shell,\
	org.apache.felix.gogo.runtime,\
	org.apache.felix.log,\
...


But I have absolutely no clue why this could be. What relationship could the gogo shell have to those errors? I've tried swapping them out of a bunch of different logging implementations and stuff as a shot in the dark, but it has to be those bundles. And I'd rather not ship them as part of the finished product, as they really have no business being there...

Here is the full (working) set of bundles I'm deploying (minus a couple of unrelated of my own):

	org.apache.felix.configadmin,\
	org.apache.felix.gogo.command,\
	org.apache.felix.gogo.shell,\
	org.apache.felix.gogo.runtime,\
	org.apache.felix.log,\
	org.apache.felix.scr,\
	org.eclipse.core.jobs,\
	org.eclipse.core.net,\
	org.eclipse.ecf,\
	org.eclipse.ecf.filetransfer,\
	org.eclipse.ecf.identity,\
	org.eclipse.ecf.provider.filetransfer,\
	org.eclipse.equinox.common,\
	org.eclipse.equinox.metatype,\
	org.eclipse.equinox.p2.artifact.repository,\
	org.eclipse.equinox.p2.core,\
	org.eclipse.equinox.p2.engine,\
	org.eclipse.equinox.p2.jarprocessor,\
	org.eclipse.equinox.p2.metadata,\
	org.eclipse.equinox.p2.metadata.repository,\
	org.eclipse.equinox.p2.repository,\
	org.eclipse.equinox.p2.transport.ecf,\
	org.eclipse.equinox.preferences,\
	org.eclipse.equinox.registry,\
	org.eclipse.equinox.security,\
	org.osgi.service.metatype,\
	org.tukaani.xz


Any thoughts? More information which might be useful? Thanks for reading.

[Updated on: Tue, 07 June 2016 09:05]

Report message to a moderator

Re: Huge variety of ClassNotFoundExceptions trying to load P2 repositories [message #1734349 is a reply to message #1734287] Tue, 07 June 2016 10:58 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 333
Registered: July 2009
Location: Ottawa
Senior Member
I'm not sure how everything is setup in your application, but it seems to me that the real root cause of the error is not reported. I mean that the problem is not in the loading of the p2 class itself, but one of its dependency.
To really find what is happening you would have to debug the class loading code of Equinox to discover the real failure (or enable class loading trace).
Re: Huge variety of ClassNotFoundExceptions trying to load P2 repositories [message #1734428 is a reply to message #1734349] Wed, 08 June 2016 11:01 Go to previous message
Elias Vasylenko is currently offline Elias VasylenkoFriend
Messages: 19
Registered: December 2015
Junior Member
Thanks for the response. Unless I'm not understanding something, the class loading trace gives me no clues about dependency classes failing to load.

ctrl-f for " failed" only finds failures for the classes already directly reported by the exceptions I am getting, e.g:

ModuleClassLoader[org.eclipse.equinox.p2.core_2.4.0.v20150527-1706].loadClass(org.eclipse.equinox.internal.p2.engine.ProfilePreferences)
BundleLoader[org.eclipse.equinox.p2.core_2.4.0.v20150527-1706].findClassInternal(org.eclipse.equinox.internal.p2.engine.ProfilePreferences)
BundleLoader[org.eclipse.equinox.p2.core_2.4.0.v20150527-1706].findLocalClass(org.eclipse.equinox.internal.p2.engine.ProfilePreferences)
ModuleClassLoader[org.eclipse.equinox.p2.core_2.4.0.v20150527-1706 - C:\Users\tofuser\AppData\Local\Temp\configuration\org.eclipse.osgi\25\0\bundleFile].findClassImpl(org.eclipse.equinox.internal.p2.engine.ProfilePreferences)
ModuleClassLoader[org.eclipse.equinox.p2.core_2.4.0.v20150527-1706].loadClass(org.eclipse.equinox.internal.p2.engine.ProfilePreferences) failed.
java.lang.ClassNotFoundException: org.eclipse.equinox.internal.p2.engine.ProfilePreferences cannot be found by org.eclipse.equinox.p2.core_2.4.0.v20150527-1706


It looks to me like it's just trying to load the classes from the bundle which is looking for it instead of the one which exports that package...

Please let me know if there is any other information which would be useful.
Previous Topic:How to upgrade singleton plugins using p2?
Next Topic:P2 loses user installed plugins after installing plugins as admin
Goto Forum:
  


Current Time: Thu Apr 25 12:01:46 GMT 2024

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

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

Back to the top