Eclipse workspace fails to start after crash - quick fix

 

Here’s a quick HOWTO for resolving Eclipse startup workspace loading problems. If you have a better suggestion then please leave a comment!

There can be a lot of other issues but here is one of the quite common ones - eclipse resources cache or state gets out of sync/corrupted.

This can happen when your IDE crashes OR also without crashing. For non-crashing case it’s more likely a logic/bug problem and whenever possible, try to file a bug at bugs.eclipse.org!

Sometimes, just SOMETIMES, you’ll get exceptions like following when launching Eclipse IDE after crashing it:

Root exception:
org.eclipse.core.internal.resources.ResourceException(null)[567]:
java.io.UTFDataFormatException: malformed input around byte 394
at java.io.DataInputStream.readUTF(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at org.eclipse.core.internal.resources.WorkspaceTreeReader_1.
readPluginsSavedStates(WorkspaceTreeReader_1.java:111)
at org.eclipse.core.internal.resources.WorkspaceTreeReader_1.
readTree(WorkspaceTreeReader_1.java:159)
at org.eclipse.core.internal.resources.SaveManager.restoreTree(SaveManager.java:916)
at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:647)
at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1319)
at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:1949)
at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:1713)
at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:363)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.
run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)

The key here is row “org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:647)”.

This stakctrace means your root .tree file is damaged and thereby unable to restore your opened projects.

The quickest way to fix this or any other resource-related exception is to:

  1. Shut down Eclipse IDE
  2. Remove and backup your workspace/.metadata/.plugins/org.eclipse.core.resources directory
  3. Start Eclipse IDE (with -clean to be super-safe)
  4. Reimport all projects (UPDATE: Just use File->Import->Existing Project into Workspace and browse your workspace/project directory)
  5. Enjoy

Maybe deleting workspace/.metadata/.plugins/org.eclipse.core.resources/.root/*tree would have been good enough for my case but it’s definitely not a workaround for other possible workspace resource state and cache related exceptions.

I’m not sure if this information without any reproducible steps is useful for bugs.eclipse.org. Not filing it this time. Or should I?

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (3) Tuesday, January 15, 2:47 pm

Configuring Eclipse SVN (Subclipse) to use JavaHL(JNI)

Configuring JavaHL for Eclipse is not as straightforward as it could be so posting a quick HOWTO. Following applies mostly to Linux users.

With Ubuntu the fool-proof steps are:

  1. Make sure libsvn-java, subversion and libsvn1 packages are installed
  2. Add following to the end of your eclipse.ini file: -Djava.library.path=/usr/lib/jni
  3. Restart eclipse and make sure JavaHL is selected under Window->Preferences->Team->SVN

By using JavaHL it gets more likely that your svn repo doesn’t get screwed up when using both command-line/shell and subclipse for svn.



Configuring Eclipse to use native SVN client - JavaHL

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (1) Thursday, January 10, 4:04 pm

New Memberships

 

Just for the record, Codehoop is now the member of “Eclipse Friends” and official OSGi Supporter.

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Comments (0) Thursday, January 10, 2:43 pm