Eclipse "Creation of Element Failed"

Dean J picture Dean J · Jan 15, 2010 · Viewed 7.8k times · Source

I'm using WID 6.1, built on Eclipse 3.x.

When trying to right click a folder, New->Class, type a name for the class, then click Finish, I get the error

"Creation of element failed. org.xml.sax.SAXParseException: Premature end of file."

I recreated my workspace yesterday when this happened, but now it's happening again. Reinstalling WID is a two or three hour task, so I'd much prefer to fix the actual problem.

Suggestions?

edit: after a second restart of WID, I'm now getting "Error initializing Java Tooling.", which is more searchable than the original error message I was getting.

edit: looking in the WID/Eclipse logs, there's an exception, but it doesn't tell me which project or which file.

Caused by: org.xml.sax.SAXParseException: Premature end of file.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at org.eclipse.wst.common.internal.emf.utilities.DOMUtilities.loadDocument(Unknown Source)
    ... 21 more

Answer

Dean J picture Dean J · Jan 15, 2010

Click on Window, Show View, Error Log.

Remove all projects from the workspace.

Reload projects one by one into workspace, looking at error log.

For the projects that caused errors on load, went into their .settings folder and saw that files there were empty and/or 0-bytes. Removed all of them, and it worked again.