Debugging

With the Workspace 2.0, debugging Mifos is normally as easy as Debugging As > Java Application the org.mifos.server.workspace.WorkspaceServerLauncherMain, typically via the Mifos START 8080.launch configuration in the mifos-server-workspace project.

For the rare cases when you need to debug a packaged WAR anyways, here is how to attach Eclipse to a Mifos WAR in an external Jetty:

  1. build the mifos.war
  2. copy it into your external Jetty's
  3. similar to Running Mifos with Jetty, launch Jetty with JVM remote debug options (note how due to suspend=y it will wait until the remote Debugger connects to the process), like so:

$ java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xms1024M -Xmx1024M -XX:MaxPermSize=256m -jar start.jar

  1. right-click mifos-server-workspace, Debug As > Debug Configurations, Remote Java Application, New Launch Configuration, Debug. (We're using the mifos-server-workspace just because that has the most complete classpath, with Jetty on it as well, and this helps for pre-configured source code look-up in the Debugger. Eclipse doesn't actually use any code from that project's classpath of course.)

http://www.ibm.com/developerworks/opensource/library/os-eclipse-javadebug/index.html has more on how to debug Java applications remotely with Eclipse.

Again, just to be very clear and avoid any confusion, normally one can just debug the full Mifos Application (including Web/UI layer) as if you would e.g. a simpler Unit Test; the instructions on this page are only needed in special cases, e.g. when needing the debug some bug which occurs ONLY in the packaged & deployed WAR and not in the Eclipse Workspace - which due to how the Workspace 2.0 is configured should normally be quite rare.