| Summary: | Changing Ant Home and Reloading build file results in ClasscastException | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Channing Walton <channingwalton> | ||||||
| Component: | Ant | Assignee: | Kevin Barnes <cocoakevin> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | abhishekmnrec, brad.cupit, Darin_Swanson, derek.clarkson, eclipse.org, matthew.gaunt, rossi, rssinnema, spamthis, wouter.groeneveld | ||||||
| Version: | 3.2 | ||||||||
| Target Milestone: | 3.2.1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Channing Walton
Also reproduceable with the following steps: Open an Ant buildfile that has an import which triggers a reparse in the open Ant editor. The problem is we are incorrectly getting into the cached XML parser in JAXPUtils with the parse of the imported file from the import task. We handle this in the "normal" parsing case of the main buidlfile but not for the imported file case (normal case was in bug 59764). This bug has existed for quite some time and results in no loss of data nor a crash...downgrading from critical. I will investigate a fix. *** Bug 149767 has been marked as a duplicate of this bug. *** *** Bug 149848 has been marked as a duplicate of this bug. *** Any chance this fix could make it into Eclipse 3.2.1 instead? It seems to me that most large projects that use Ant would use the import task to mimic build script 'inheritance'. This bug would prevent them from being able to use Eclipse 3.2 (since their build scripts would not open in the Ant editor anymore). Sure there's the workaround of opening the build script in the plain text editor, but it would be a tough sell to my co-workers trying to convince them to upgrade to Eclipse 3.2 even though they're losing the ability to use the Ant editor for the majority of our Ant scripts. Please, can it make it into 3.2.1? I was going to consider this for 3.2.1..thank you for the nudge. I will expect some user testing / verification of the fix in return :-) Note as well that with my testing that if you restart Eclipse after setting the Ant home the problem goes away. As well, if you remove the xerces JARs (xercesImpl.jar and xml-apis.jar) from the Ant runtime classpath for the ANT HOME the problem goes away as well. (In reply to comment #5) > I was going to consider this for 3.2.1..thank you for the nudge. > I will expect some user testing / verification of the fix in return :-) Definitely! Thank you!!! As for restarting Eclipse, I've noticed that one too. I did not know about removing the xerces jars though. Nice workaroud. I think I'll try it out. *** Bug 150322 has been marked as a duplicate of this bug. *** *** Bug 150958 has been marked as a duplicate of this bug. *** *** Bug 152441 has been marked as a duplicate of this bug. *** Full test case that always reproduces for me: 1. Change the Global Ant home using the Ant runtime classpath pref page to point to Ant 1.6.4 install which includes the Xerces libraries. 2. Open the import.xml buildfile. Close the file 3. "Restore Defaults" on the Ant runtime classpath pref page to set the global Ant home to the default 4. Open the import.xml buildfile. Close the file 5. Change the global Ant home to point to Ant 1.6.4 install 6. Open the import.xml buildfile. Created attachment 47353 [details]
import.xml
Created attachment 47354 [details]
toBeImport.xml
We have the same problem with Antlib usage. The fix is more involved there as the Apache Ant implementation is hard coded to use their project helper. Logged bug 152793. I have released a fix to both 3.3 and 3.2.1 streams. A thorough pounding on the new code by the community would be greatly appreciated. Thanks Darin Please verify Kevin et al (In reply to comment #15) > I have released a fix to both 3.3 and 3.2.1 streams. > Excellent! Thanks Darin!! verified *** Bug 158095 has been marked as a duplicate of this bug. *** (In reply to comment #5) > I was going to consider this for 3.2.1..thank you for the nudge. > I will expect some user testing / verification of the fix in return :-) > This is working great in Eclipse 3.2.1! Thanks Darin!!! *** Bug 214343 has been marked as a duplicate of this bug. *** I'm still having the problem with Eclipse 3.4.1 (M20080911-1700). ANT_HOME is set to and ant 1.7.1 installation. This is from the logfile: !ENTRY org.eclipse.ant.ui 4 0 2008-10-16 16:17:13.463 !MESSAGE Internal error occurred retrieving targets !STACK 0 java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source) at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source) at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source) at org.apache.tools.ant.util.JAXPUtils.newSAXParser(JAXPUtils.java:215) at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:172) at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:185) at org.apache.tools.ant.helper.ProjectHelper2.parseUnknownElement(ProjectHelper2.java:86) at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:75) at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:429) at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:281) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at org.eclipse.ant.internal.ui.model.AntDefiningTaskNode.configure(AntDefiningTaskNode.java:86) at org.eclipse.ant.internal.ui.model.AntModel.resolveBuildfile(AntModel.java:504) at org.eclipse.ant.internal.ui.model.AntModel.resolveBuildfile(AntModel.java:506) at org.eclipse.ant.internal.ui.model.AntModel.resolveBuildfile(AntModel.java:506) at org.eclipse.ant.internal.ui.model.AntModel.resolveBuildfile(AntModel.java:506) at org.eclipse.ant.internal.ui.model.AntModel.resolveBuildfile(AntModel.java:506) at org.eclipse.ant.internal.ui.model.AntModel.parseDocument(AntModel.java:329) at org.eclipse.ant.internal.ui.model.AntModel.reconcile(AntModel.java:265) at org.eclipse.ant.internal.ui.model.AntModel.getProjectNode(AntModel.java:1386) at org.eclipse.ant.internal.ui.model.AntModel.getProjectNode(AntModel.java:1396) at org.eclipse.ant.internal.ui.AntUtil.getTargets(AntUtil.java:237) at org.eclipse.ant.internal.ui.launchConfigurations.AntTargetsTab$8.run(AntTargetsTab.java:519) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:458) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:366) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:758) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:755) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2487) at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1217) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1210) at org.eclipse.ant.internal.ui.launchConfigurations.AntTargetsTab.getTargets(AntTargetsTab.java:536) at org.eclipse.ant.internal.ui.launchConfigurations.AntTargetsTab.initializeFrom(AntTargetsTab.java:645) at org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup.initializeFrom(AbstractLaunchConfigurationTabGroup.java:86) at org.eclipse.ant.internal.ui.launchConfigurations.AntTabGroup.initializeFrom(AntTabGroup.java:48) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupWrapper.initializeFrom(LaunchConfigurationTabGroupWrapper.java:143) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.displayInstanceTabs(LaunchConfigurationTabGroupViewer.java:787) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer$8.run(LaunchConfigurationTabGroupViewer.java:663) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.inputChanged(LaunchConfigurationTabGroupViewer.java:680) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput0(LaunchConfigurationTabGroupViewer.java:642) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput(LaunchConfigurationTabGroupViewer.java:618) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.handleLaunchConfigurationSelectionChanged(LaunchConfigurationsDialog.java:959) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$4.selectionChanged(LaunchConfigurationsDialog.java:566) at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:842) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:880) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:840) at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1639) at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1104) at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:392) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.doInitialTreeSelection(LaunchConfigurationsDialog.java:606) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.initializeContent(LaunchConfigurationsDialog.java:1061) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.createContents(LaunchConfigurationsDialog.java:442) at org.eclipse.jface.window.Window.create(Window.java:431) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.create(LaunchConfigurationsDialog.java:371) at org.eclipse.jface.window.Window.open(Window.java:790) at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.open(LaunchConfigurationsDialog.java:1113) at org.eclipse.debug.ui.DebugUITools$1.run(DebugUITools.java:388) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:396) at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:332) at org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run(OpenLaunchDialogAction.java:81) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) Andreas your problem is bug 152793. I have this problem with Eclipse 3.6.0 and Ant 1.6.5. The workaround in #6 fixed it for me. |