eclipse 打开xml文件时出现Eclipse问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6724420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:37:53  来源:igfitidea点击:

Eclipse problem occurred at opening xml file

xmleclipsemacosm2e

提问by Alx

for some reasons I can't open plain xml files anymore. I did a few tests and even with a fresh, untouched copy of eclipse (64bit cocoa), I can't open xml files. What I did is, created a new java project, created a new xml file. The only thing I get is following message:

由于某些原因,我无法再打开纯 xml 文件。我做了一些测试,即使使用了 eclipse(64 位可可)的全新、未改动的副本,我也无法打开 xml 文件。我所做的是,创建了一个新的 java 项目,创建了一个新的 xml 文件。我唯一得到的是以下消息:

An error has occurred. See error log for more details. Could not initialize class org.eclipse.m2e.editor.xml.PomContentAssistProcessor

发生了错误。有关更多详细信息,请参阅错误日志。无法初始化类 org.eclipse.m2e.editor.xml.PomContentAssistProcessor

Any ideas what the reason might be?

任何想法可能是什么原因?

update:

更新:

I had a closer look at the error log, displaying following:

我仔细查看了错误日志,显示如下:

java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.m2e.editor.xml.PomContentAssistProcessor

Somehow dependencies are missing, but I don't know how to solve it. I tried to re-install m2e, but it just told me that it is already installed and will only show up in installed applications.

不知何故缺少依赖项,但我不知道如何解决。我试图重新安装 m2e,但它只是告诉我它已经安装并且只会出现在已安装的应用程序中。

Here's the full stacktrace, maybe somebody has an advice what to do next.

这是完整的堆栈跟踪,也许有人会建议下一步该做什么。

java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.m2e.editor.xml.PomContentAssistProcessor
    at org.eclipse.m2e.editor.xml.PomStructuredTextViewConfiguration.getContentAssistProcessors(PomStructuredTextViewConfiguration.java:31)
    at org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration.getContentAssistant(StructuredTextViewerConfiguration.java:291)
    at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.configure(StructuredTextViewer.java:215)
    at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3407)
    at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:54)
    at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:440)
    at org.eclipse.wst.sse.ui.StructuredTextEditor.createPartControl(StructuredTextEditor.java:1508)
    at org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:241)
    at org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:211)
    at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.addSourcePage(XMLMultiPageEditorPart.java:509)
    at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.createPages(XMLMultiPageEditorPart.java:764)
    at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)
    at org.eclipse.ui.internal.EditorManager.findEditor(EditorManager.java:424)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2887)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
    at org.eclipse.ui.internal.WorkbenchPage.access(WorkbenchPage.java:2842)
    at org.eclipse.ui.internal.WorkbenchPage.run(WorkbenchPage.java:2793)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764)
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:355)
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:164)
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249)
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376)
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.open(PackageExplorerPart.java:538)
    at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
    at org.eclipse.jface.viewers.StructuredViewer.run(StructuredViewer.java:866)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil.run(JFaceUtil.java:49)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
    at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1256)
    at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
    at org.eclipse.jface.util.OpenStrategy.access(OpenStrategy.java:269)
    at org.eclipse.jface.util.OpenStrategy.handleEvent(OpenStrategy.java:309)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4125)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3971)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3610)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    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:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

回答by Vitali Bichov

Had the same problem with indigo, just opened the original downloaded zip and overwritten all the jar files in plugins directory that start with org.eclipse.m2e.*and the problem disappeared.

indigo也有同样的问题,打开原来下载的zip文件,把plugins目录下的jar文件全部覆盖org.eclipse.m2e.*,问题就消失了。

回答by gannu_lee

I got this worked by starting my Eclipse(Kepler) with a -clean parameter..

我通过使用 -clean 参数启动我的 Eclipse(Kepler) 来解决这个问题。

"d:\eclipse\eclipse.exe -clean"

When I tried this, eclipse took more time than usual to comeup, as it will be cleaning and reloading plug-ins.

当我尝试这个时,eclipse比平时花更多的时间来启动,因为它会清理和重新加载插件。

回答by J Slick

Similar problem when attempting to open XML or Java files:
org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPartCould not open xml or java files.

尝试打开 XML 或 Java 文件时出现类似问题:
org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart无法打开 xml 或 java 文件。

Eclipse Kepler 4.3. IDE got killed by a winturds system restart.
Subsequently, started IDE, error

Eclipse 开普勒 4.3。IDE 被 winturds 系统重启杀死。
随后,启动IDE,报错

My clever solution: Exit IDE through File:Exit and restart the IDE. This has happened before.

我的巧妙解决方案:通过 File:Exit 退出 IDE 并重新启动 IDE。以前也发生过这种情况。

Your mileage may vary.

你的旅费可能会改变。

回答by Bozho

If a fresh copy doesn't work this means the workspace or project metadata is corrupted. Try creating a new workspace.

如果新副本不起作用,这意味着工作区或项目元数据已损坏。尝试创建一个新工作区。

The problem looks related to m2eclipse - eclipse is trying to load the pom-editor but fails. You can try installing/updating m2eclipse as well.

问题看起来与 m2eclipse 有关 - eclipse 正在尝试加载 pom 编辑器但失败了。您也可以尝试安装/更新 m2eclipse。

回答by kazzikazzi

Same problem with luna. Regenerate the library plug-in dependencies worked for me.

露娜也有同样的问题。重新生成对我有用的库插件依赖项。