Most of the Java application servers, such as JBoss, Websphere, weblog, follow a rule of JPDA (Java Platform Debugger Architecture). The JPDA make it possible to have a remote debugger from the app server. The only two things we have to do are below:
1. Enable remote debugging function of our application server;
2. Config parameters of remote debugging in Eclipse.
Here is an example of JBoss following the above steps:
1. Enable remote debugging function of our application server;
Open ${JBoss_Home}\bin\run.bat(or run.sh for linux). Fortunately, we can find a line "rem JPDA options. Uncomment and modify as appropriate to enable remote debugging." . So what we should do is to Uncomment the next line instead of doing anything else. After finishing it, we start the server and we can see the server is waiting for the remoting connection, prompting: Listening for transport dt_soctet at address:8787.
2.Config parameters of remote debugging in Eclipse.
Config Debug . Add a Remote Java Application, which is our application. Behold, the connection port must be same as it is in run.bat. The default value should be 8787. At last click "Debug" button.
Now, we can debug the server.
PS. In order to make the debugger work properly, The class files published must have the same version with our java source files.