Community
Participate
Working Groups
I have a task that uses xerces and when it tries to load a xerces class, a ClassCastException is thrown. After tracking down the problem, it appears that two versions of xerces are in memory: 1 - the one that my tasks uses (it got loaded through the regular plugin loader hierarchy) 2 - the one that the antLoader is using. To be precise, the xerces classes are loaded in the antLoader because it is not chained to the xerces plugin classloader and simply refers to the jars (see AntCorePreferences::getDefaultAntURLs). To avoid this problem, instead of referencing directly jars you should reference the classloader that olds on to these jars. If I was not clear, don't hesitate to contact me. Note that this was working fine before the fix for bug #21793 has been put in, because xerces is using the contextClassLoader to load its classes.
I agree. Since org.eclipse.ant.core requires the org.apache.xerces plugin it should set that plugin classloader to be a parent plugin classloader instead of adding the URLs for the xerces JARs to the AntClassloader classpath. In fact, this would just work if we remove the xerces JARs. The plugin classloader for the org.eclipse.ant.core is already added as a plugin classloader.
Fixed in AntCorePreferences. Please verify (Jared).
Verified code. Pascal, can you please verify that your test case works correctly now?
*** Bug 33650 has been marked as a duplicate of this bug. ***
*** Bug 33447 has been marked as a duplicate of this bug. ***
I checked on a windows machine with the code from HEAD. It works. I'll do a test on a linux box later in the afternoon.