In this post I will show you, how you can debug a remotely deployed java application using eclipse IDE (the post is applicable for a plain java program as well as applications deployed using Web Servers or Application Servers e.g weblogic, websphere etc)
Why you really need to debug a java application which is deployed remotely:
Lets consier my case,
I stay in India and develop java application in windows machine. Project team deploys the same java application to the unix servers in USA and come back to me saying “The Java application is not working there”
But, how this can happen…!!! I tested everything at my windows machine and everything was just fine!!
What you do to resolve this (all possible options) :
1. Using vpn you connect to the remote server/machine and perform the following:
run the process, ftp the logs generated by the application to your windows machine , analyze the logs, would give a fix if possibe just by looking at the logs, deploy the application again in the unix server, go back to step 1 i.e run the process and cycle continues till it gets resolved
2. You create a similar setup of that remote machine next to your desktop… do you really think in practical case you afford doing this?? (I understand in few cases people might do but I would never recommend you doing this)
Beleive me, both the above options are frustrating and time taking to do.Just think, while developing in you IDE, do u really care analysing the logs for every small error you get in a program?? guess NO, The most likey straight forward answer is- YOU DEBUG with the help of your favourite IDE.
Follow the two simple steps to debug using Eclipse IDE
STEP 1: Just restart the remote server (or re-run the simple remote java program ) with the following Java options…
STEP 2: configuring Eclipse debugger: you can easily Configure your local Eclipse IDE to Debug the remotely running process using below steps:
1. Start the eclipse
2. Go to Run -> Debug Configurations
3. Create a new Remote Java configuration
4. Configure the remote application’s details
5. Click apply changes and done. 🙂
Doing this you will be able to debug the remote java application as if it’s running in your local machine(desktop) only.