unable to instantiate view

Tell us what you think about our book and report any errata. Sample chapters are available at http://www.qualityeclipse.com/

(Note: Previous Editions were called "Eclipse: Building Commercial Quality Plugins")

Moderators: Eric Clayberg, Dan Rubel

unable to instantiate view

Postby hauss » Fri Aug 27, 2004 10:48 am

When I try to run the very first plugin in chapter 2, the favorites one... (export it, shut down eclipse, unzip the plugin, start up eclipse), I see it in my other views window but when I try to show it I get an "unable to instantiate view" error. However when I do a run runtime workbench and do window -> show view -> other, I see the view fine with One Two Three ...

Why isn't it working in my eclipse (without having to run the runtime workbench to see the view?)
hauss
 

Re: unable to instantiate view

Postby Eric Clayberg » Fri Aug 27, 2004 11:13 am

hauss wrote:When I try to run the very first plugin in chapter 2, the favorites one... (export it, shut down eclipse, unzip the plugin, start up eclipse), I see it in my other views window but when I try to show it I get an "unable to instantiate view" error. However when I do a run runtime workbench and do window -> show view -> other, I see the view fine with One Two Three ...

Why isn't it working in my eclipse (without having to run the runtime workbench to see the view?)

Do any exceptions appear in your Eclipse ".log" file?

You may be running into a major Eclipse bug. Eclipse 3.0 may not immediately recognize new plugins. This occurs because Eclipse 3.x caches plug-in information for a faster startup at the cost of not recognizing changes to the installed plugins. To workaround this problem, include the "-clean" option on the command line used to startup Eclipse. The "-clean" option causes Eclipse to reparse and recache the plug-in information, picking up any newly installed or revised features. Once the plug-in information has been recached and your plugin appears as expected, you can remove the "-clean" option. Deleting the Eclipse "configuration" directory (it is recreated on startup) and re-starting Eclipse should also have the same effect.

Alternatively, you can use the technique described in the Eclipse 3.0 readme file:

    When features and plug-ins are manually installed on top of an Eclipse-based product install located on a FAT file system that has already been run at least once, the product must be explicitly restarted with the system property osgi.checkConfiguration set to true. This property can be set in the eclipse/configuration/config.ini file, or passed to the eclipse command line via the -vmargs option. For example, restart with the following command: eclipse.exe -vmargs -Dosgi.checkConfiguration=true. Then, open Help > Software Updates > Manage Configuration dialog and toggle on the "Show disabled features" button its toolbar. Select the newly "installed" feature and press on the "Enable feature" action on the right pane (or select the action from the feature's context menu).
Let me know if the above helps.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Chp 2 Plugin

Postby mcleran » Mon Aug 30, 2004 8:45 pm

I have the exact opposite problem. I can get the plugin to work if I build the zip file, but it gives me an error when I try to run it in the debug runtime workbench. I get a very helpful message:

Unable to instantiate view: com.qualityeclipse.favorites.views.FavoritesView

Reason:
Unable to instantiate view: com.qualityeclipse.favorites.views.FavoritesView
:evil:
mcleran
 

Re: Chp 2 Plugin

Postby Eric Clayberg » Tue Aug 31, 2004 3:57 am

mcleran wrote:I have the exact opposite problem. I can get the plugin to work if I build the zip file, but it gives me an error when I try to run it in the debug runtime workbench. I get a very helpful message:

Unable to instantiate view: com.qualityeclipse.favorites.views.FavoritesView

Reason:
Unable to instantiate view: com.qualityeclipse.favorites.views.FavoritesView
:evil:

Does anything show up in the ".log" file in the runtime workbench? That would probably provide more detail on what the actual problem is.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Chp 2 Plugin

Postby mcleran » Tue Aug 31, 2004 5:30 pm

Thanks for the reply, Eric. Here is a small snippet from the runtime workbench log file (it looks like the plugin class is not found at runtime, any ideas?):

!SESSION Aug 31, 2004 19:27:31.572 ---------------------------------------------
eclipse.buildId=unknown
java.version=1.4.2_04
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -application org.eclipse.ui.ide.workbench

!ENTRY org.eclipse.core.runtime 4 2 Aug 31, 2004 19:27:31.572
!MESSAGE Plug-in "com.qualityeclipse.favorites" was unable to instantiate class "com.qualityeclipse.favorites.FavoritesPlugin".
!STACK 0
java.lang.NoSuchMethodException: com.qualityeclipse.favorites.FavoritesPlugin.<init>(org.eclipse.core.runtime.IPluginDescriptor)
mcleran
 

Re: Chp 2 Plugin

Postby Eric Clayberg » Tue Aug 31, 2004 6:15 pm

mcleran wrote:any ideas?

It may be a plugin dependency issue. What plugins are in your plugin.xml requires list?

If you haven't already done so, review the book errata page note on runtime classpath settings.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Chp 2 Plugin

Postby mcleran » Tue Aug 31, 2004 7:00 pm

Same problem. Here's my plugin dependencies:

<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime.compatibility" optional="true"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.debug.ui"/>
<import plugin="org.eclipse.help"/>
<import plugin="org.eclipse.help.ui"/>
<import plugin="org.eclipse.jdt.core"/>
<import plugin="org.eclipse.jdt.ui"/>
<import plugin="org.eclipse.jface"/>
<import plugin="org.eclipse.jface.text"/>
<import plugin="org.eclipse.swt"/>
<import plugin="org.eclipse.text"/>
<import plugin="org.eclipse.ui.editors"/>
<import plugin="org.eclipse.ui.views"/>
<import plugin="org.eclipse.ui.workbench"/>
<import plugin="org.eclipse.ui.workbench.texteditor"/>
<import plugin="org.eclipse.osgi" optional="true"/>
<import plugin="org.eclipse.ui.ide" optional="true"/>
</requires>


Here's a dump of the log file:

!SESSION Aug 31, 2004 20:57:58.65 ----------------------------------------------
eclipse.buildId=unknown
java.version=1.4.2_04
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -application org.eclipse.ui.ide.workbench

!ENTRY org.eclipse.core.runtime 4 2 Aug 31, 2004 20:57:58.75
!MESSAGE Plug-in "com.qualityeclipse.favorites" was unable to instantiate class "com.qualityeclipse.favorites.FavoritesPlugin".
!STACK 0
java.lang.NoSuchMethodException: com.qualityeclipse.favorites.FavoritesPlugin.<init>(org.eclipse.core.runtime.IPluginDescriptor)
at java.lang.Class.getConstructor0(Class.java:1929)
at java.lang.Class.getConstructor(Class.java:1019)
at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(PluginDescriptor.java:403)
at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDescriptor.java:359)
at org.eclipse.core.internal.plugins.PluginDescriptor.getPlugin(PluginDescriptor.java:328)
at org.eclipse.core.internal.compatibility.PluginActivator.start(PluginActivator.java:47)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:958)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:954)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:937)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:421)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:293)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(EclipseClassLoader.java:110)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:371)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:307)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:336)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1313)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:131)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:124)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:113)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:196)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:193)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:76)
at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:287)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at org.eclipse.ui.internal.ViewFactory.busyRestoreView(ViewFactory.java:259)
at org.eclipse.ui.internal.ViewFactory$2.run(ViewFactory.java:516)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.ViewFactory.restoreView(ViewFactory.java:514)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:1583)
at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:774)
at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:754)
at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:3008)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3005)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:2985)
at org.eclipse.ui.internal.ShowViewMenu.showOther(ShowViewMenu.java:204)
at org.eclipse.ui.internal.ShowViewMenu$2.run(ShowViewMenu.java:68)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
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:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
at org.eclipse.core.launcher.Main.run(Main.java:644)
at org.eclipse.core.launcher.Main.main(Main.java:628)

!ENTRY org.eclipse.osgi Aug 31, 2004 20:57:58.125
!MESSAGE An error occured while automatically activating bundle com.qualityeclipse.favorites (8).
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.core.internal.compatibility.PluginActivator.start() of bundle com.qualityeclipse.favorites.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:975)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:937)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:421)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:293)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(EclipseClassLoader.java:110)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:371)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:307)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:336)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1313)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:131)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:124)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:113)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:196)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:193)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:76)
at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:287)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at org.eclipse.ui.internal.ViewFactory.busyRestoreView(ViewFactory.java:259)
at org.eclipse.ui.internal.ViewFactory$2.run(ViewFactory.java:516)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.ViewFactory.restoreView(ViewFactory.java:514)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:1583)
at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:774)
at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:754)
at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:3008)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3005)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:2985)
at org.eclipse.ui.internal.ShowViewMenu.showOther(ShowViewMenu.java:204)
at org.eclipse.ui.internal.ShowViewMenu$2.run(ShowViewMenu.java:68)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
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:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
at org.eclipse.core.launcher.Main.run(Main.java:644)
at org.eclipse.core.launcher.Main.main(Main.java:628)
Caused by: org.eclipse.core.runtime.CoreException: Plug-in "com.qualityeclipse.favorites" was unable to instantiate class "com.qualityeclipse.favorites.FavoritesPlugin".
at org.eclipse.core.internal.plugins.PluginDescriptor.throwException(PluginDescriptor.java:284)
at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(PluginDescriptor.java:406)
at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDescriptor.java:359)
at org.eclipse.core.internal.plugins.PluginDescriptor.getPlugin(PluginDescriptor.java:328)
at org.eclipse.core.internal.compatibility.PluginActivator.start(PluginActivator.java:47)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:958)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:954)
... 57 more
Root exception:
org.eclipse.core.runtime.CoreException[2]: java.lang.NoSuchMethodException: com.qualityeclipse.favorites.FavoritesPlugin.<init>(org.eclipse.core.runtime.IPluginDescriptor)
at java.lang.Class.getConstructor0(Class.java:1929)
at java.lang.Class.getConstructor(Class.java:1019)
at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(PluginDescriptor.java:403)
at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDescriptor.java:359)
at org.eclipse.core.internal.plugins.PluginDescriptor.getPlugin(PluginDescriptor.java:328)
at org.eclipse.core.internal.compatibility.PluginActivator.start(PluginActivator.java:47)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:958)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:954)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:937)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:421)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:293)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(EclipseClassLoader.java:110)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:371)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:307)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:336)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1313)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:131)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:124)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:113)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:196)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:193)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:76)
at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:287)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at org.eclipse.ui.internal.ViewFactory.busyRestoreView(ViewFactory.java:259)
at org.eclipse.ui.internal.ViewFactory$2.run(ViewFactory.java:516)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.ViewFactory.restoreView(ViewFactory.java:514)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:1583)
at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:774)
at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:754)
at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:3008)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3005)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:2985)
at org.eclipse.ui.internal.ShowViewMenu.showOther(ShowViewMenu.java:204)
at org.eclipse.ui.internal.ShowViewMenu$2.run(ShowViewMenu.java:68)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
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:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
at org.eclipse.core.launcher.Main.run(Main.java:644)
at org.eclipse.core.launcher.Main.main(Main.java:628)

!ENTRY org.eclipse.core.runtime 4 1 Aug 31, 2004 20:57:58.145
!MESSAGE Plug-in com.qualityeclipse.favorites was unable to load class com.qualityeclipse.favorites.views.FavoritesView.
!STACK 0
java.lang.ClassNotFoundException: com.qualityeclipse.favorites.views.FavoritesView
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:404)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:307)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:336)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1313)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:131)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:124)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:113)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:196)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:193)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:76)
at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:287)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at org.eclipse.ui.internal.ViewFactory.busyRestoreView(ViewFactory.java:259)
at org.eclipse.ui.internal.ViewFactory$2.run(ViewFactory.java:516)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.ViewFactory.restoreView(ViewFactory.java:514)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:1583)
at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:774)
at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:754)
at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:3008)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3005)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:2985)
at org.eclipse.ui.internal.ShowViewMenu.showOther(ShowViewMenu.java:204)
at org.eclipse.ui.internal.ShowViewMenu$2.run(ShowViewMenu.java:68)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
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:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
at org.eclipse.core.launcher.Main.run(Main.java:644)
at org.eclipse.core.launcher.Main.main(Main.java:628)
mcleran
 

Chp 2 Plugin

Postby mcleran » Tue Aug 31, 2004 7:04 pm

Same problem. I copied the requires section of the errata into my plugin manifest, but I still get the same message in the error log.

I have my debugger set up to perform a clean every time, is that a problem? Seems unlikely.
mcleran
 

Re: Chp 2 Plugin

Postby Eric Clayberg » Wed Sep 01, 2004 4:48 pm

Nothing jumps put at me from the log file other than to check that all the necessary methods are present in your plugin class. Have you tried downloading the final version of the plugin from the book site and comparing to that?
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Chp 2 Plugin

Postby mcleran » Thu Sep 02, 2004 7:10 pm

Thanks for the help, Eric.

I grabbed the Chp2 source for the FavoritesPlugin class and it works now. I don't know what I did wrong. I went back into my local history and saw the differences between what works and doesn't.

The Chp2 source works fine, but gives me alot of warnings about using deprecated features. What I had must have been generated by Eclipse for my plugin class.

This does NOT work:

package com.qualityeclipse.favorites;

import org.eclipse.ui.plugin.*;
import org.osgi.framework.BundleContext;
import java.util.*;

/**
* The main plugin class to be used in the desktop.
*/
public class FavoritesPlugin extends AbstractUIPlugin {
//The shared instance.
private static FavoritesPlugin plugin;
//Resource bundle.
private ResourceBundle resourceBundle;

/**
* The constructor.
*/
public FavoritesPlugin() {
super();
plugin = this;
try {
resourceBundle = ResourceBundle.getBundle("com.qualityeclipse.favorites.FavoritesPluginResources");
} catch (MissingResourceException x) {
resourceBundle = null;
}
}

/**
* This method is called upon plug-in activation
*/
public void start(BundleContext context) throws Exception {
super.start(context);
}

/**
* This method is called when the plug-in is stopped
*/
public void stop(BundleContext context) throws Exception {
super.stop(context);
}

/**
* Returns the shared instance.
*/
public static FavoritesPlugin getDefault() {
return plugin;
}

/**
* Returns the string from the plugin's resource bundle,
* or 'key' if not found.
*/
public static String getResourceString(String key) {
ResourceBundle bundle = FavoritesPlugin.getDefault().getResourceBundle();
try {
return (bundle != null) ? bundle.getString(key) : key;
} catch (MissingResourceException e) {
return key;
}
}

/**
* Returns the plugin's resource bundle,
*/
public ResourceBundle getResourceBundle() {
return resourceBundle;
}
}
mcleran
 

What is actually going wrong

Postby Irene Levina » Wed Sep 29, 2004 9:24 am

Eclipse template generate plugin code based on updated AbstractUIPlugin API:

Such an in case of FavoritesPlugin it will generate the following constructor:

public FavoritesPlugin()
{
super();
plugin = this;
...
}

Here where problem is happen: Eclipse plugin loader try to instantiate FavoritesPlugin(IPluginDescriptor) to load FavoritesPlugin which is depricated method in AbsractUIPlugin base class. Book example code for Favorites Plugin use depicated constructor method.

Just changing generated code to use depricated constructor instead of generated one wil solve a problem with view instantiation :)

It could be Eclipse bug or any specific to 3.0 configuration issue?
It will be nice to know, if anybody figure out how to resolve a problem without a changing very simple plugin generated code (Chapter 2 issue)
Irene Levina
 

Re: What is actually going wrong

Postby Eric Clayberg » Wed Sep 29, 2004 4:29 pm

One important reason for continuing to use the deprecated constructor is that it will work in any version of Eclipse including 2.0, 2.1 and 3.0. Using the Eclipse 3.0 -only code locks you in to only one version of Eclipse. A significant number of Eclipse users are using Eclipse 2.0 and 2.1 which are the basis for IBM's WSAD versions 5.0 and 5.1. Eclipse 3.0 won't be in wide spread use amongst commercial Eclipse users until IBM's next release of the commercial IDEs later this year.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Book: Eclipse Plug-Ins (3rd Edition)

Who is online

Users browsing this forum: No registered users and 1 guest