最近要将原来的RCP 3.2的项目从GEF改为GMF 2,只能使用Eclipse 3.3来开发,当我把在3.2下运行很好的项目倒入到3.3启动的时候报告一个很奇怪的错误:
!ENTRY org.eclipse.osgi 4 0 2008-05-30 12:54:33.671
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "org.eclipse.ui.ide.workbench" could not be found in the registry. The applications available are: org.eclipse.jdt.core.JavaCodeFormatter, org.eclipse.update.core.standaloneUpdate, org.eclipse.update.core.siteOptimizer, org.eclipse.equinox.app.error.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.EclipseAppContainer.start(EclipseAppContainer.java:98)
at org.eclipse.equinox.internal.app.Activator.addingService(Activator.java:112)
at org.osgi.util.tracker.ServiceTracker$Tracked.trackAdding(ServiceTracker.java:1064)
at org.osgi.util.tracker.ServiceTracker$Tracked.trackInitialServices(ServiceTracker.java:926)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:330)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:274)
at org.eclipse.equinox.internal.app.Activator.start(Activator.java:54)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:405)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.eclipse.core.internal.runtime.PlatformActivator.startAppContainer(PlatformActivator.java:47)
at org.eclipse.core.internal.runtime.PlatformActivator.start(PlatformActivator.java:32)
....
红色字体表示workbench这个application并没有加载到RCP runtime中来,Plugin registry里面没有注册信息,在3.2中 extension org.eclipse.ui.ide.workbench是申明在插件org.eclipse.ui.ide中的,通过Plugin Registry Search,发现在3.3中,这个extension declaration被挪到插件org.eclipse.ui.ide.application中了,于是在项目的product配置中加入org.eclipse.ui.ide.application这个插件依赖,然后选中这个插件,点击"Add Required Plug-ins",再clear, 启动,运行正常。
从这个令人恼火的改动来看,Eclipse在逐渐向它的两个趋势之一靠拢,即成为产品开发平台(RCP)。(另外一个是向OSGi标准看齐)