If you are an eclipse user you may have come across this error atleast once in you lifetime. Sometimes this error shown as a message “Widget disposed too early” or something like that. To be more precise when starting eclipse it just hands on a small blank dialog kind of form after specifying the workspace. You cannot close or exit from this form. It just hangs.
This happens mostly in linux. I experienced this in ubuntu hardy with Ganymede mostly. If this happenes first thing you should do it to verify the problem. Just check the log for the workspace to see what the exception thrown before eclipse hanged. For example in our case it will be something like this.
Exception in thread “Thread-1” org.eclipse.
swt.SWTError: XPCOM error -2147467262
at org.eclipse.swt.browser.Mozilla.error(Mozilla.java:1360)
at org.eclipse.swt.browser.Mozilla.setText(Mozilla.java:1564)
at org.eclipse.swt.browser.Browser.setText(Browser.java:716)
at org.eclipse.jdt.internal.ui.infoviews.JavadocView.setInput(JavadocView.java:531)
at org.eclipse.jdt.internal.ui.infoviews.JavadocView.refresh(JavadocView.java:452)
at org.eclipse.jdt.internal.ui.infoviews.JavadocView.setBackground(JavadocView.java:439)
at org.eclipse.jdt.internal.ui.infoviews.AbstractInfoView.inititalizeColors(AbstractInfoView.java:327)
at org.eclipse.jdt.internal.ui.infoviews.AbstractInfoView.createPartControl(AbstractInfoView.java:191)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:372)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.j……
…..
Now for the solution.
Well the solution is a bit murkey. I came across the worst path of solving the problem with the only solution available. Eclipse uses XUL (spelled “zool”) for its GUI rendering when in linux. This is kind of weird because the actually reason i figured out is that it uses the platform current browser to do that for him. This in the case of linux where the default browser is most of the time is Mozilla Firefox, eclipse uses the functionalities of firefox to render its GUI. If in the case of windows it uses IE as I can remember. This is why the above exception contains the words like “browser” “mozilla” etc.
Anyway the problem occures due to a simple reason, the firefox browser does the rendering using the xulrunner. There is a default xulrunner when firefox is installed and this version is not updated enough for eclipse. Thus it cannot render the UI parts and the UI widgets are disposed not being able to be created correctly. So the easy solution is to update the xulrunner.
You can do a simple
$apt-get update xulrunner or $apt-get install xulrunner
Works most of the time. But sometimes its best to do a system wide upgrade using
$apt-get upgrade
because there is a version firefox which xulrunner also supports, and if the firefox is old (or in 3.0beta for eaxmple), the xulrunner will not get updated properly.
So after that the eclipse should work fine. But mind you, you might want to start on a fresh workspace anyway.
But i have seem in some instances where eclipse can start on a already created (and previously worked) workspaces. Yeah i know, WIERD!!!
Well In my case this worked great on eclipse, but with a hitch. The firefox was giving trouble now. The address bar not working properly, icons in the title bar disabled, No history or bookmarks shown etc. It looked like the upgrade messed up the firefox.
With a little bit of searching I found that this can happen if the firefox profile gets corrupted. For those of you who does not know what a firefox profile is, its just a simple profiles created by the firefox to keep track of each and every uses preferences/history/bookmarks/etc etc.
So all you have to do is to create a new firefox profile abadoning the one you already have. Google for how to create a new profile. For those of who wants to keep the old one all they have to do is to go and rename the “localstore.rdf” file to say “localstore.rdf.tmp” and restart the browser. (This file is normally located in “~/.mozilla/firefox/<somefolder_for_the_profile>/localstore.rdf”).
localstore.rdf is the file where most of the settings of the profile are declared. When this file is missing the browser automatically resets the settings for the browser. And you will see that the buttons and icons etc will start working normally again 🙂
but make sure u rename the “localstore.rdf.tmp” back to “localstore.rdf” after the browser resets the settings. Because if not eclipse again will start giving problems and this time it will not be specific on what the problem is. It will not even mention that the problem is with the profile of the browser. It will just not behavie as you expect and make you think there is something wrong in you code (because most of the time it doesn’t throw an exception also). In my case this happened to me. Where i was not able to add a dynamic project to the tomcat server as the runtime environment. We can add the dynamic projects to run with the tomcat server from the left list box to right list box (if u can remember). Both the list boxes will just remain empty. And there will be no hint on whats exactly wrong. So i restored the localstore.rdf file and it started working again.
Hope this helped anyone. Dont want someone else to waste a day to solve this problem.