未处理的事件循环异常Eclipse

时间:2018-05-16 12:17:59

标签: java eclipse

如果我单击“运行方式”来运行该类,则会出现以下错误,然后eclipse不会运行任何内容。如何解决这个问题?

java.lang.IllegalArgumentException
    at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:226)
    at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java:125)
    at org.testng.eclipse.util.TestSearchEngine.doIsTest(TestSearchEngine.java:273)
    at org.testng.eclipse.util.TestSearchEngine.doIsTest(TestSearchEngine.java:257)
    at org.testng.eclipse.util.TestSearchEngine.isTest(TestSearchEngine.java:225)
    at org.testng.eclipse.launch.tester.JavaTypeExtender.isTest(JavaTypeExtender.java:29)
    at org.testng.eclipse.launch.tester.JavaTypeExtender.test(JavaTypeExtender.java:14)
    at org.testng.eclipse.launch.tester.TestNGPropertyTester.isTestClass(TestNGPropertyTester.java:60)
    at org.testng.eclipse.launch.tester.TestNGPropertyTester.test(TestNGPropertyTester.java:42)
    at org.eclipse.core.internal.expressions.Property.test(Property.java:58)
    at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:99)
    at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
    at org.eclipse.core.internal.expressions.IterateExpression.evaluate(IterateExpression.java:150)
    at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
    at org.eclipse.core.internal.expressions.WithExpression.evaluate(WithExpression.java:72)
    at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
    at org.eclipse.core.internal.expressions.EnablementExpression.evaluate(EnablementExpression.java:53)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension.evalEnablementExpression(LaunchShortcutExtension.java:287)
    at org.eclipse.debug.ui.actions.ContextualLaunchAction.isApplicable(ContextualLaunchAction.java:295)
    at org.eclipse.debug.ui.actions.ContextualLaunchAction.fillMenu(ContextualLaunchAction.java:218)
    at org.eclipse.debug.ui.actions.ContextualLaunchAction$1.menuShown(ContextualLaunchAction.java:137)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:255)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
    at org.eclipse.jface.action.ActionContributionItem.copyMenu(ActionContributionItem.java:1268)
    at org.eclipse.jface.action.ActionContributionItem.handleShowProxy(ActionContributionItem.java:1248)
    at org.eclipse.jface.action.ActionContributionItem.access$4(ActionContributionItem.java:1237)
    at org.eclipse.jface.action.ActionContributionItem$8.handleEvent(ActionContributionItem.java:1210)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
    at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4881)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4557)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
    at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
    at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
    at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
    at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:257)
    at org.eclipse.swt.widgets.Display.runPopups(Display.java:4210)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
    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:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)

1 个答案:

答案 0 :(得分:1)

您使用的Eclipse版本不了解testng插件所请求的ASTParser版本(来自行号:可能是AST.JLS8,请参阅https://github.com/cbeust/testng-eclipse/blob/master/testng-eclipse-plugin/src/main/org/testng/eclipse/util/TestSearchEngine.java

尝试升级到最新的Eclipse版本,请参阅https://www.eclipse.org/downloads/