Show me the code! – By Davanum Srinivas

November 20, 2009

Debug code running on IBM Websphere using Eclipse / Intellij IDEA

Filed under: Uncategorized — Davanum Srinivas @ 1:39 pm

NOTE: Please back up the files before you modify them.

Step #1 : Edit the server.xml (for example $WAS_HOME/profiles/AppSrv01/config/cells/AppSrv01/nodes/AppSrv01/servers/server1/server.xml). Find the processDefinitions element and look for the jvmEntries under it. A typical entry looks like this:

  <processDefinitions xmi:type="processexec:JavaProcessDef" 
    <execution xmi:id="ProcessExecution_1183122130078" 
    <ioRedirect xmi:id="OutputRedirect_1183122130078" 
    <monitoringPolicy xmi:id="MonitoringPolicy_1183122130078" 
		maximumStartupAttempts="3" pingInterval="60" 
		pingTimeout="300" autoRestart="true" 
    <jvmEntries xmi:id="JavaVirtualMachine_1183122130078" 
		verboseModeJNI="false" runHProf="false" 
      <systemProperties xmi:id="Property_1" name="" value="off" required="false"/>
      <systemProperties xmi:id="Property_2" name="" value="off" required="false"/>

Step #2: Do you see the debugMode in the jvmEntries section? switch it from false to true and save the file.


Step #3: Restart the server as usual using say the command line

root@dims-desktop:/opt/WAS70/profiles/AppSrv01/bin# ./ server1
ADMU0116I: Tool information is being logged in file
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: server1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server server1 open for e-business; process id is 6913

Step #4: Using latest IntelliJ or Eclipse, you can use Remote debugging to attach to the running Websphere server. Please specify the same port (“7777” in example above) as mentioned in the server.xml. Here are screen shots from Eclipse and Intellij on how to set up the debug configuration.

Step #5: Use the debug configuration created in the previous step, set up break points in your application and attach to the running Websphere process.

That’s it!


  1. It always surprises me how easy this is to do. For people who don’t want to edit their main configuration or hand edit their server.xml (I’ve messed up a few installations doing that…), another way to do this is to generate a new startup script..

    Run \bin\startServer.bat server1 -script

    That generates a start_server1.bat script you can use to start the server which has the following line in it:

    @REM set DEBUG=-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777

    Simply remove the @REM and when you start the server with that script it’s in debug mode, and when you start it with the normal script it’s in normal mode.
    I assume there’s a parallel on non-windows platforms, but I’ve never tried it

    Comment by David Illsley — November 20, 2009 @ 3:12 pm

    • Probably easier to just enable this from the admin console <server / Process Definition / JVM .. Also, don't want to forget that telling Websphere to start in debug mode is going to have pretty hefty performance implications for you. YMMV.

      Comment by John Pape — November 20, 2009 @ 4:44 pm

  2. David’s suggestion is the one I always use.

    Comment by Mike Rheinheimer — November 28, 2009 @ 9:17 pm

  3. thanks, i’ve always wondered what the easy dirty way to step in to code hosted on WAS in eclipse was and this makes it pretty easy.

    Comment by damour — November 15, 2010 @ 3:33 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: