Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Do m2e/maven override the current class loader and forget to remove it?

On Mon, Jul 7, 2014 at 3:12 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
> In any case, I am not aware of any thread context classloader "leaks" in
> m2e, so if somebody believes there is such leak please provide a quality
> fix and I'll review and apply it.

Thanks for the reply and for the detailed references. I worked around
this situation at our end by setting the TCCL to a well-known 'good'
ClassLoader.

Robert

>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=396554
> [2]
> http://blog.bjhargrave.com/2007/07/contextfinder-in-eclipse-is-broken.html
> </quoate>
>
>
> --
> Regards,
> Igor
>
>
> On 2014-07-07, 16:01, Robert Munteanu wrote:
>>
>> 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
>>
> _______________________________________________
> m2e-dev mailing list
> m2e-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/m2e-dev



-- 
http://robert.muntea.nu/


Back to the top