[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[m2e-dev] Do m2e/maven override the current class loader and forget to remove it?
|
Hi,
I'm developing an Eclipse plugin [1] which coexists with m2e. I have
seen a seemingly random bug where a class loading operation fails [2]
. The CNFE makes no sense initially, since all the classes are placed
in jars and then in the Bundle-Classpath of a single bundle.
Digging a bit deeper, I noticed that one of the classes uses
Class.forName(klazz, Thread.currentThread().getContextClassLoder()) .
In the case when the class loading succeeds, the context class loader is
org.eclipse.core.runtime.internal.adaptor.ContextFinder@5cbe48ab
However, when it fails it is
ClassRealm[project>com.example:test002.components:0.0.1-SNAPSHOT,
parent: ClassRealm[maven.api, parent: null]]
The stack trace shows nothing related to m2e, therefore my tentative
conclusion that somehow the TCCL is not cleared:
javax.jcr.RepositoryException: java.lang.ClassNotFoundException:
org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory
at org.apache.jackrabbit.client.RepositoryFactoryImpl.getRepository(RepositoryFactoryImpl.java:71)
at org.apache.jackrabbit.vault.davex.DAVExRepositoryFactory.createRepository(DAVExRepositoryFactory.java:124)
at org.apache.sling.ide.jcr.RepositoryUtils.getRepositoryAddress(RepositoryUtils.java:71)
at org.apache.sling.ide.jcr.RepositoryUtils.getRepository(RepositoryUtils.java:44)
at org.apache.sling.ide.impl.vlt.VltRepository.connect(VltRepository.java:65)
at org.apache.sling.ide.impl.vlt.VltRepositoryFactory.connectRepository(VltRepositoryFactory.java:69)
at org.apache.sling.ide.eclipse.core.ServerUtil.connectRepository(ServerUtil.java:154)
at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.start(SlingLaunchpadBehaviour.java:88)
at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadLaunchConfigurationDelegate.launch(SlingLaunchpadLaunchConfigurationDelegate.java:45)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:700)
at org.eclipse.wst.server.core.internal.Server.startImpl2(Server.java:3541)
at org.eclipse.wst.server.core.internal.Server.startImpl(Server.java:3477)
at org.eclipse.wst.server.core.internal.Server$StartJob.run(Server.java:367)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ClassNotFoundException:
org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.jackrabbit.client.RepositoryFactoryImpl.getRepository(RepositoryFactoryImpl.java:65)
... 15 more
So my question is whether this is a bug to file or something that I
can somehow work around in my application.
Thanks,
Robert
[1]: https://sling.apache.org/documentation/development/ide-tooling.html
[2]: https://issues.apache.org/jira/browse/SLING-3739
--
http://robert.muntea.nu/