Friday, February 18, 2011

Java memory analysis (OutOfMemoryError for example) tools

Just wanted to share the memory analysis tool that i happened to use recently when i hit an out of memory error in our application.. so far the experience has been good..

Memory analysis tool
(available as standalone tool or as eclipse plugin)

Tutorial on using MAT

Sun vs IBM JDK
Sun JDK generates heap dumps as .hprof files that are supported out of the box by MAT. 
If you are using IBM JDK then it generates .phd files that are not supported by MAT by default (atleast at time of this writing). 
But it can be resolved by installing IBM Diagnostic tool Framework. For more details and for download link, see

Saturday, January 1, 2011

java.lang.ClassCastException: com.google.apphosting.utils.jetty.AppEngineWebAppContext $AppEngineServletContext cannot be cast to org.mortbay.jetty.handler.ContextHandler$SContext

Quoting the solution from here,

Did you accidentally include appengine-local-runtime.jar in your
WEB-INF/lib?
So removing it solves the problem.

'GWT module may need to be recompiled' popup in browser

Quoting the solution from here,

This error usually means that you are missing the ?gwt.codesrv= (sp?)
parameter, probably gets lost in your redirect to the page
 Just get the full URL with ? from 'Development mode' tab in Eclipse after you start the server/run as web application and paste it in browser.
Or if you use 'ant devmode' say 'Copy to Clipboard' and paste it in browser.