Pages

12 February, 2013

Debugging SetUp In Eclipse

 
Please follow the steps to configure the Dedugging mode Eclipse:

TOMCAT :

 
1) Open the catalina.bat file in edit mode which is available in "{tomcat home}\bin\catalina.bat" path

2) Add the below two lines in catalina.bat after the "rem --------------------------------------" line

set JPDA_ADDRESS=8000
set JPDA_TRANSPORT="dt_socket"


 
  


3) Create a shortcut for catalina.bat and paste it in desktop

4) Right click the shortcut and select 'properties' option.

5) Select the 'Shortcut' tab in properties window.

6) Add the { " } at the begining and ending of the path in target.

7) Append the below text at the end of the path.

jpda start




  1. Open the debug configuration window

  1. Add a debug config under “Remote Java Application



  2. Configure the project which has to be debugged.

  1. Select “source” tab in Debug configuration


  1. add the project in the source list.
  2. Apply the settings and close the window.
  3. Start the catalina shortcut which is in desktop.
  4. Start the configured debug in eclipse.


    JBOSS:


    This is really useful – only recently found out how to do this and the benefit is enormous. Basically by a small configuration on JBoss’s startup configuration and a setting...

    This is really useful – only recently found out how to do this and the benefit is enormous. Basically by a small configuration on JBoss’s startup configuration and a setting in Eclipse we can toggle breakpoints in our java code so that we can see where our code gets stuck and the JBoss processes that it goes through.

    Start with JBoss, you’ll need to edit its run file (/jboss/bin/run.sh or run.bat) and un-comment line
    JBoss-Debug-RunFile
    This tells JBoss which port to use to listen to for debug commands and it enables the JBoss’s remote debugging functionality.
    JBoss-Debug-Eclipse-Debug
    Next we need to go to Eclipse and configure the debugger in there. If you go to the Window menu at the top and then go to Open Perspective and look for Debug (you may need to choose it from the Other menu). Once you’re in this perspective you can then setup an application profile for your debugger – look for the bug symbol on the top tool bar and select the Debug Configurations menu.
    JBoss-Debug-Eclipse-Debug-Config
    In here we choose to create a new Remote Java Application giving it a name and connection details for your JBoss server – so in my case its localhost. The port MUST be the same as the port expected in your JBoss run file, in this case by default its port 8787.
    JBoss-Debug-Eclipse-Debug-New-Config
    Ok thats it – debug should be setup. When you start JBoss it’ll pause waiting for you to start the debugger in Eclipse – just go back to the bug symbol and select your configuration you just made. JBoss will continue to load after this point and Eclipse should start showing you JBoss’s processes that it’s running.
    JBoss-Debug-Startup
    Now we can add in breakpoints to our code allowing us to step through the code when its activated on JBoss – so if a user submits a form that calls in a bean which does x, y, z then we can see the logic that happens and if any issues occur – this is really useful for things like payment pipelines.
    JBoss-Debug-Eclipse-Debug-Breakpoint
    To toggle a breakpoint or to enable/ disable an existing one, just click in the left margin of your code window at the line you want to begin to step through. When this line gets processed JBoss will stop and you can then use the step through commands on the debug menu.
    JBoss-Debug-Eclipse-Debug-Step-Through
    If you’re using the startDynamoOnJboss and run-in-place methods for your server then you can debug and fix your code theoretically very quickly and easily.

    BY

    SANA


1 comment: