5

JUnit プラグイン テストを実行すると、java.lang.NoClassDefFoundErrorが発生し続けます。

ここに不足しているバンドルがいくつかありますが、プラグインを実行しているときにこれらも取得し、そこですべてが正常に機能するため、それが問題であるとは思えません。

!ENTRY org.eclipse.osgi 2 0 2012-04-20 10:27:45.533
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2012-04-20 10:27:45.533
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.help.base_3.6.2.v201202080800.jar/ was not resolved.
!SUBENTRY 2 org.eclipse.help.base 2 0 2012-04-20 10:27:45.533
!MESSAGE Missing required bundle org.apache.lucene_[2.9.0,3.0.0).

!ENTRY org.eclipse.osgi 2 0 2012-04-20 10:27:45.541
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2012-04-20 10:27:45.542
!MESSAGE Bundle org.eclipse.help.base_3.6.2.v201202080800 [54] was not resolved.
!SUBENTRY 2 org.eclipse.help.base 2 0 2012-04-20 10:27:45.542
!MESSAGE Missing required bundle org.apache.lucene_[2.9.0,3.0.0).
!SUBENTRY 2 org.eclipse.help.base 2 0 2012-04-20 10:27:45.542
!MESSAGE Missing optionally imported package org.eclipse.equinox.http.jetty_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2012-04-20 10:27:45.542
!MESSAGE Bundle org.eclipse.sdk_3.7.2.v201202080800 [78] was not resolved.
!SUBENTRY 2 org.eclipse.sdk 2 0 2012-04-20 10:27:45.542
!MESSAGE Missing required bundle org.eclipse.help.ui_[3.2.0,4.0.0).
!SUBENTRY 2 org.eclipse.sdk 2 0 2012-04-20 10:27:45.543
!MESSAGE Missing required bundle org.eclipse.help.base_[3.1.0,4.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2012-04-20 10:27:45.543
!MESSAGE Bundle org.eclipse.help.ui_3.5.101.r37_20110819 [126] was not resolved.
!SUBENTRY 2 org.eclipse.help.ui 2 0 2012-04-20 10:27:45.543
!MESSAGE Missing required bundle org.eclipse.help.base_[3.5.0,4.0.0).

!ENTRY org.eclipse.equinox.app 0 0 2012-04-20 10:27:45.551
!MESSAGE Product org.eclipse.sdk.ide could not be found.

私が得るスタックトレースは次のとおりです。

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NoClassDefFoundError: junit/framework/TestCase)
    at org.eclipse.swt.SWT.error(SWT.java:4282)
    at org.eclipse.swt.SWT.error(SWT.java:4197)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
    at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:41)
    at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
    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(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:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.NoClassDefFoundError: junit/framework/TestCase
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
    at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner$BundleClassLoader.findClass(RemotePluginTestRunner.java:38)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
    at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    ... 26 more
Caused by: java.lang.ClassNotFoundException: junit.framework.TestCase
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 87 more

後でもう一つ

Exception in thread "WorkbenchTestable" org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NoClassDefFoundError: junit/framework/TestCase)
    at org.eclipse.swt.SWT.error(SWT.java:4282)
    at org.eclipse.swt.SWT.error(SWT.java:4197)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:196)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4683)
    at org.eclipse.ui.internal.testing.WorkbenchTestable.runTest(WorkbenchTestable.java:112)
    at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.runTests(PlatformUITestHarness.java:69)
    at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: junit/framework/TestCase
...
Caused by: java.lang.ClassNotFoundException: junit.framework.TestCase
...

junit プラグインを runco​​nfig に追加しました。

誰かが私を正しい方向に向けることができますか?

編集: 「必要なプラグインの追加」で追加された junit プラグインは次の ここに画像の説明を入力 とおりです。junit4 への参照を削除し、テスト ランナー JUnit3 でプラグイン テストを開始しました。

4

2 に答える 2

1

欠けていたプラグインは

org.eclipse.xtext.xbase.junit
org.junit (3.8.2)
org.junit (4.8.2)
于 2012-04-23T18:15:57.623 に答える
0

どのJUnitプラグインを追加しましたか?エラーがJUnit3以前を参照していることに気づきました(junit.framework.TestCase

JUnit3クラスとJUnit4クラスを混在させないでください。通常は機能しますが、非常に奇妙で見つけにくいエラーが発生する可能性があります。

プロジェクトを右クリックして、を選択し、タブの下にあるプロジェクトを確認することもできPropertiesますJava Build Path...LibrariesそこにJUnitjarファイルがあります。ライブラリのバージョンが使用しているバージョンと互換性があることを確認してください。

于 2012-04-20T09:00:11.473 に答える