eclipse "Creation of Element Failed"

标签 eclipse saxparseexception wid

我使用的是基于 Eclipse 3.x 构建的 WID 6.1。

当尝试右键单击文件夹,“新建”->“类”,键入类的名称,然后单击“完成”时,出现错误

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

昨天发生这种情况时,我重新创建了工作区,但现在又发生了。重新安装 WID 是一个两三个小时的任务,所以我更愿意解决实际问题。

建议?

编辑:第二次重新启动 WID 后,我现在收到“初始化 Java 工具时出错。”,该消息比我原来的错误消息更易于搜索。得到。

编辑:查看 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

最佳答案

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

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

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

对于导致加载错误的项目,进入其 .settings 文件夹并看到其中的文件为空和/或 0 字节。把它们全部删除,它又起作用了。

关于 eclipse "Creation of Element Failed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2072913/

相关文章:

java - 无需源码远程调试

android - Fabric 插件 Android Eclipse 的登录无效

websphere - IBM Websphere Application Server 和 IBM Websphere Process Server 之间的区别?

soa - 有使用 Websphere Integration Developer (WID) 的经验吗?

java - 为什么添加到 .java 文件的方法在构建后不存在于 .class 文件中,或者在导入包后无法访问?

java - 简单的休息服务与 Tomcat 和 Eclipse,Mac 操作系统。请求的资源不可用

java - 如何将 Netbeans 项目转移到 Eclipse 中?

java - 严重 : Parse error in application web. xml

java - 当运行使用 Apache Camel 开发的 jar 时,如何修复路由标记中的 SAXParseException?

java - 当我尝试在模拟器 android studio 上运行应用程序时出错