私はプラグインBに依存するプラグインを持っています。プラグインAからプラグインBで定義されたクラスをロードしようとしています。クラスがエクスポートされたパッケージに含まれていると確信しています。私はClassNotFoundExceptionを取得した、私は何かを欠場しましたか?eclipse rcp:クラス読み込みの問題
page = (IPage) Class.forName(pageClass).newInstance();
エラーメッセージ:
java.lang.ClassNotFoundException: amarsoft.dbmp.credit.web.dataobject.DOListPage
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(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at amarsoft.rcp.base.widgets.DefaultPageRegistry.findPage(DefaultPageRegistry.java:27)
at amarsoft.rcp.base.widgets.AbstractPageControler.showPage(AbstractPageControler.java:27)
at amarsoft.rcp.base.widgets.AbstractPageControler.showPage(AbstractPageControler.java:37)
at amarsoft.dbmp.function.ui.FunctionListPage$3.linkActivated(FunctionListPage.java:261)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:233)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:327)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.access$2(AbstractHyperlink.java:311)
at org.eclipse.ui.forms.widgets.AbstractHyperlink$4.handleEvent(AbstractHyperlink.java:125)
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.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
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$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.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 amarsoft.adt.rcp.ADTApplication.start(ADTApplication.java:29)
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)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
'DOListPage'がエクスポートされたパッケージにある場合、コンパイルエラーなしで' new DOListPage() 'をここで実行できるはずです。これを試してもよろしいですか? – Kai
これは役に立ちますか? http://codescale.wordpress.com/2009/05/22/basics-about-osgi-classloading/ – FlorianOver
Platform.getBundle( "amarsoft.dbmp.credit.web.dataobject")。loadClass(pageClass).newInstance( )はうまくいくでしょう – CaiNiaoCoder