Eclipse“创建元素失败”
我正在使用基于 Eclipse 3.x 构建的 WID 6.1。
当尝试右键单击文件夹,“新建”->“类”,键入类的名称,然后单击“完成”时,出现错误
“创建元素失败。 org.xml.sax.SAXParseException: 文件过早结束。”
昨天发生这种情况时,我重新创建了我的工作区,但现在又发生了。重新安装 WID 是一个两三个小时的任务,所以我更愿意解决实际问题。
有建议吗?
编辑: 第二次重新启动 WID 后,我现在收到“初始化 Java 工具时出错”。比我收到的原始错误消息更易于搜索:
。 /i> 查看 WID/Eclipse 日志,有一个异常,但它没有告诉我哪个项目或哪个文件。
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单击“窗口”、“显示视图”、“错误日志”。
从工作区中删除所有项目。
将项目一一重新加载到工作区中,查看错误日志。
对于导致加载错误的项目,进入其 .settings 文件夹并看到其中的文件为空和/或 0 字节。把它们全部删除,又可以了。
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.