[STS-2490] Grails Plugin Manager will not launch Created: 08/Mar/12  Updated: 30/Apr/12  Resolved: 29/Mar/12

Status: Resolved
Project: Spring Tool Suite
Component/s: GRAILS
Affects Version/s: 2.9.0.RELEASE
Fix Version/s: 2.9.2.RELEASE, 3.0.0.M1

Type: Bug Priority: Minor
Reporter: Scott Doyle Assignee: Kris De Volder
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows XP



 Description   

I have a Grails application v1.3.6 in my STS 2.9.0 workspace and when I right-click on the project and select Grails Tools > Grails Plugin Manager. A quick window saying "Resolving list of available plugins" displays for a brief second and then closes. The plugin manager never launches and there is no output in the Console indicating that it tried to get a list of plugins.



 Comments   
Comment by Kris De Volder [ 08/Mar/12 ]

Are there any error in the Eclipse error log?

Comment by Scott Doyle [ 08/Mar/12 ]

!ENTRY org.eclipse.ui 4 0 2012-03-08 14:46:39.650
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
at com.springsource.sts.frameworks.ui.internal.plugins.PluginManagerDialog.restoreOriginalState(PluginManagerDialog.java:1069)
at com.springsource.sts.frameworks.ui.internal.plugins.PluginManagerDialog.setViewerInput(PluginManagerDialog.java:1240)
at com.springsource.sts.frameworks.ui.internal.plugins.PluginManagerDialog.resynchPluginsList(PluginManagerDialog.java:816)
at com.springsource.sts.frameworks.ui.internal.plugins.PluginManagerDialog.createCommandArea(PluginManagerDialog.java:306)
at com.springsource.sts.frameworks.ui.internal.plugins.CommandDialog.createDialogArea(CommandDialog.java:68)
at org.eclipse.jface.dialogs.TitleAreaDialog.createContents(TitleAreaDialog.java:155)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
at org.eclipse.jface.window.Window.open(Window.java:790)
at com.springsource.sts.grails.ui.internal.actions.OpenGrailsPluginsManagerActionDelegate.run(OpenGrailsPluginsManagerActionDelegate.java:54)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
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: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.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)

Comment by Kris De Volder [ 08/Mar/12 ]

Assigning to Nieraj. NPE is in code he wrote.

Comment by Nieraj Singh [ 08/Mar/12 ]

Unfortunately, I am not able to reproduce this error. Is this issue reproducible every time the Grails Plugin Manager is launched, or does it occur only on certain occasions? Thanks.

Comment by Scott Doyle [ 09/Mar/12 ]

It happens every time I try to launch it. Could it be possible that it is having issues with being behind a proxy server. I have the proxy server configuration set up in Window > Preferences > General > Network Connections. I also set the proxy in Grails. Is the Plugin Manager checking for and using proxy server settings?

Comment by Scott Doyle [ 09/Mar/12 ]

If I execute the list-plugins command from the Grails Command Prompt I am able to get a listing of plugins without a problem.

Comment by Kris De Volder [ 29/Mar/12 ]

I just ran into this bug while testing for Grails 1.3.8. Nieraj helped debug it.
We discovered that it is a bug which rarely occurs. It is triggered by duplicate entries in the downloaded list of plugins.

Once you hit the problem, it will keep re-occurring for you because you will have a cached copy of the plugin list file on your disk. So even if the list changes later on on the server and other people may not be seeing the problem, the unlucky guy who has a cached copy with duplicates... will have a problem.

Refreshing the list of plugins may make the problem go away (assuming the list has been fixed on the server).
since you can't actually open the plugin manager. You may need to manually delete the plugin list files from your .grails folder to clear out the file.

I am now adding some code to fix the problem (i.e. so STS handles the duplicate entries better).

Comment by Kris De Volder [ 29/Mar/12 ]

Closing: Fix is committed.

Comment by Scott Doyle [ 30/Mar/12 ]

Thanks for finding this Kris. I am very busy on a project right now. Can you tell me where the list is cached under .grails so I don't have to delete the entire contents under .grails?

Comment by Kris De Volder [ 02/Apr/12 ]

For me, when using Grails 2.0.1 the files are here:
/home/kdvolder/.grails/2.0.1/plugins-list-grailsCentral.xml
/home/kdvolder/.grails/2.0.1/plugins-list-grailsCore.xml

I'm not 100% sure about this, but I think if you run a grails command "grails list-plugins" on the command line or with the Grails command prompt in STS, it should also refresh the file contents. You may need to refresh-dependencies and/or restart STS after modifying/deleting the files since there's also an in-memory cache of the list.

Kris

Comment by Scott Doyle [ 27/Apr/12 ]

I just reinstalled STS 2.9.1 and am having the same problem. I implemented your suggestion by deleting the files :

/.grails/2.0.3/plugins-list-grailsCentral.xml
.grails/2.0.3/plugins-list-grailsCore.xml

I also restarted STS. When I try to launch the Plugin Manager I see that it is executing the list-plugin command and lists the available plugins, but the Plugin Manager will not display.

Comment by Kris De Volder [ 27/Apr/12 ]

Hi Scott,

The tell-tale sign whether you are hitting this bug is the NPE in the error log...
See the comment a little higher for the actual stacktrace:
https://issuetracker.springsource.com/browse/STS-2490?focusedCommentId=55950&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-55950

The workarounds may not work, the assumption for it working is that after you delete files and refresh them, their contents will no longer trigger the bug. But that assumes the files have actually changed on the servers and now have a contents that doesn't trigger the bug.

Most people I've heard from recently who had this problem have updated to a nightly build to fix the problem.

See here on the forum for other comments about the same problem, and what people did to fix it:
http://forum.springsource.org/showthread.php?125058-STS-2-9-1-Grails-Plugin-Manager-does-not-open&p=408460

Let me know if you need more help with this.

Kris

Comment by Scott Doyle [ 27/Apr/12 ]

Kris,

I see that you have this marked as resolved for version 3.0 and not 2.9.2. My problem is I want to package the tool up to distribute to a large number of workstations but could never get approval to build a package based on nightly builds and cannot distribute 2.9.1 with this bug since is it a common method for developers to add plugins.

When is 3.0 projected to be released? If it is soon I can try to hold off on building the package.

Thanks,
Scott

Comment by Scott Doyle [ 27/Apr/12 ]

By the way I ran into this same problem on my laptop at home so it seems to be a common problem.

Comment by Martin Lippert [ 27/Apr/12 ]

STS 3.0 is expected to ship in July 2012.
STS 2.9.2 is expected to ship end of May 2012.
Do you need this in 2.9.2?

Comment by Martin Lippert [ 28/Apr/12 ]

Kris, in case we cherry-pick this for 2.9.2, is this the correct commit hash for the fix:
24d51785e543c3eb95c6c744529339236dcb308d

Comment by Kris De Volder [ 30/Apr/12 ]

Correct, that is the fix. It is a very small change so backporting to 2.9.2 should be easy.

Scott is probably right. The conditions for this bug used to be rare, but from traffic on this bug and the forum, it seems that conditions that trigger it somehow are occurring much more frequently these days. Since it is quite an annoying problem I think it would be good to cherry pick for 2.9.2. I'll do this today.

Kris

Comment by Kris De Volder [ 30/Apr/12 ]

I've cherrypicked the fix on the 2.9.x branch.

Generated at Sun Aug 19 17:32:49 UTC 2018 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.