Community
Participate
Working Groups
Running the Ant UI tests in an I-build later than I20110505-0800, the Ant UI tests have a pile of failures citing a class cast exception: !ENTRY org.eclipse.ant.launching 4 0 2011-05-10 09:32:04.387 !MESSAGE Failure of Background Ant Build !STACK 1 org.eclipse.core.runtime.CoreException: org.eclipse.ant.internal.launching.runtime.logger.AntProcessBuildLogger which was specified to perform logging is not an instance of org.apache.tools.ant.BuildLogger. at org.eclipse.ant.core.AntRunner.handleInvocationTargetException(AntRunner.java:452) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:384) at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:298) at java.lang.Thread.run(Thread.java:662) Caused by: org.eclipse.ant.internal.launching.runtime.logger.AntProcessBuildLogger which was specified to perform logging is not an instance of org.apache.tools.ant.BuildLogger. at org.eclipse.ant.internal.core.ant.InternalAntRunner.createLogger(InternalAntRunner.java:749) at org.eclipse.ant.internal.core.ant.InternalAntRunner.addBuildListeners(InternalAntRunner.java:200) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:570) at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:496) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378) ... 2 more Caused by: java.lang.ClassCastException: org.eclipse.ant.internal.launching.runtime.logger.AntProcessBuildLogger cannot be cast to org.apache.tools.ant.BuildLogger at org.eclipse.ant.internal.core.ant.InternalAntRunner.createLogger(InternalAntRunner.java:745) All of the tests run fine in the I20110505-0800 build and earlier. I reproduced the failures on Win7 and Linux using the I20110507-0800 There have been no changes around InternalAntRunner that would affect this and the AntProcessDebugLogger *is* an instance of BuildLogger.
I only get the CCEs in I20110510-0800 when I check out org.eclipse.ant.launching and org.eclipse.ant.core from HEAD. When I close org.eclipse.ant.launching, the CCEs are gone and both classes use the same AntClassloader. When org.eclipse.ant.launching is open, then Class.forName(loggerClassname).getClassLoader() returns a org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader. I have no idea why this happens.
Thanks for trying it out Markus, playing around with the code in InternalAntRunner, I forced it to use the AntClassLoader via: buildLogger = (BuildLogger) (Class.forName(loggerClassname, true, getClass().getClassLoader()).newInstance()); but it still failed.
Probably related to bug 343455 comment #3. There are extra classpath entries in the dev.properties file for self hosted eclipse instances. This lets the osgi class loaders see classes they aren't supposed to. ClassCastExceptions are caused by mixing the classes loaded from OSGi classloaders with the ant URL classloader. I found this because PDE/Build tests also started failing locally.
(In reply to comment #3) > > I found this because PDE/Build tests also started failing locally. I confirmed the patch on bug 343455 resolves the local test failures. marking as worksforme