Eclipse“创建元素失败”

发布于 2024-08-18 04:28:24 字数 1438 浏览 4 评论 0原文

我正在使用基于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扬花落满肩 2024-08-25 04:28:24

单击“窗口”、“显示视图”、“错误日志”。

从工作区中删除所有项目。

将项目一一重新加载到工作区中,查看错误日志。

对于导致加载错误的项目,进入其 .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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文