Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 240369 - Ant Editor fails to load when taskdef used
Summary: Ant Editor fails to load when taskdef used
Status: CLOSED DUPLICATE of bug 196346
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows Server 2003
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-10 14:03 EDT by gbaumgardner CLA
Modified: 2010-01-12 11:48 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gbaumgardner CLA 2008-07-10 14:03:55 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1. Install a separate version of Ant with Ant-Contrib added under the root of the Ant directory, and change the Ant Home of Eclipse to point to that new Ant.

2. Create the following build.xml file in a Basic project (mine is not a Java project):
<project name="test" basedir="."
	       xmlns:ac="antlib:net.sf.antcontrib">
	
    <taskdef resource="net/sf/antcontrib/antcontrib.properties" uri="antlib:net.sf.antcontrib"
             onerror="ignore">
        <classpath>
            <fileset dir="${ant.home}/ant-contrib">
                <include name="**/*.jar" />
            </fileset>
        </classpath>
    </taskdef>
    
 </project>

3. Open up the build.xml file using the Ant Editor.  Should work just fine.

4. Modify the resource to point to the full antlib.xml supplied with Ant contrib.

<project name="test" basedir="."
	       xmlns:ac="antlib:net.sf.antcontrib">
	
    <taskdef resource="net/sf/antcontrib/antlib.xml" uri="antlib:net.sf.antcontrib"
             onerror="ignore">
        <classpath>
            <fileset dir="${ant.home}/ant-contrib">
                <include name="**/*.jar" />
            </fileset>
        </classpath>
    </taskdef>
    
 </project>

5. Save and close the build.xml file.

6. Reopen the file with Ant Editor.  It fails now.

Could not open the editor: org.apache.xerces.parsers.XIncludeAwareParserConfiguration


I am positive this was working in Eclipse 3.3, but is now broken on Eclipse 3.4 I got that includes the BIRT distribution.


More information:
Full exception:

java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration
	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.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.editor.text.AntFoldingStructureProvider.updateFoldingRegions(AntFoldingStructureProvider.java:88)
	at org.eclipse.ant.internal.ui.editor.AntEditor.projectionEnabled(AntEditor.java:1243)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled(ProjectionViewer.java:480)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection(ProjectionViewer.java:528)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1413)
	at org.eclipse.ant.internal.ui.editor.AntEditor$StatusLineSourceViewer.doOperation(AntEditor.java:215)
	at org.eclipse.ant.internal.ui.editor.AntEditor.createPartControl(AntEditor.java:971)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:428)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:266)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2820)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2729)
	at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2721)
	at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2673)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2652)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2643)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:646)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:605)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:318)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:160)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:207)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:363)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$5.open(PackageExplorerPart.java:603)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:820)
	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.fireOpen(StructuredViewer.java:818)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1079)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1183)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:263)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:257)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:297)
	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:382)
	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)
Comment 1 Darin Swanson CLA 2008-07-10 14:34:44 EDT
You are getting 2 versions of Xerces loaded resulting in the ClassCastException.
If you remove the xerces JARs (xercesImpl.jar and xml-apis.jar) from the Ant runtime classpath this will work as you expect.
Comment 2 Michael Rennie CLA 2010-01-12 11:48:32 EST
same problem and workaround as bug 196346, marking as dupe

*** This bug has been marked as a duplicate of bug 196346 ***