0
我們正在使用WindowsTester運行自動化測試。當我運行一個測試用例時,出現「java.lang.NoClassDefFoundError」錯誤。 請幫我解決這個問題。如何解決此java.lang.NoClassDefFoundError
堆棧跟蹤是:
java.lang.NoClassDefFoundError: org/eclipse/osgi/internal/loader/ModuleClassLoader
at com.windowtester.internal.runtime.bundle.BundleResolver.bundleForClass(BundleResolver.java:21)
at com.windowtester.internal.runtime.bundle.BundleResolver.bundleNameForClass(BundleResolver.java:29)
at com.windowtester.internal.runtime.bundle.BundleClassReference.forBundleClass(BundleClassReference.java:35)
at com.windowtester.internal.runtime.ClassReference.forBundleClass(ClassReference.java:26)
at com.windowtester.runtime.WidgetLocator.<init>(WidgetLocator.java:88)
at com.windowtester.runtime.WidgetLocator.<init>(WidgetLocator.java:108)
at com.windowtester.runtime.WidgetLocator.<init>(WidgetLocator.java:134)
at com.windowtester.runtime.swt.locator.SWTWidgetLocator.<init>(SWTWidgetLocator.java:139)
at com.windowtester.runtime.swt.locator.CTabItemLocator.<init>(CTabItemLocator.java:127)
at com.sample.TestUtilsGUI.closeWelcomePageIfNecessary(TestUtilsGUI.java:216)
at junit.framework.TestCase.runBare(TestCase.java:139)
at com.windowtester.runtime.common.UITestCaseCommon.access$0(UITestCaseCommon.java:1)
at com.windowtester.runtime.common.UITestCaseCommon$2.run(UITestCaseCommon.java:140)
at com.windowtester.runtime.common.UITestCaseCommon$3.run(UITestCaseCommon.java:161)
at com.windowtester.internal.runtime.junit.core.SequenceRunner$1.run(SequenceRunner.java:50)
Caused by: java.lang.ClassNotFoundException: org.eclipse.osgi.internal.loader.ModuleClassLoader cannot be found by com.windowtester.runtime_6.1.0.201310072244
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 17 more
當您的代碼在編譯時可以訪問'ModuleClassLoader.class'文件,但無法在運行時找到它時,會出現此異常。確保它在classpath中。 –
檢查類路徑以在Eclipse中添加所有OSGI插件依賴jar – user1933888