Visit Map

Tuesday, June 20, 2006

Debugging in Eclipse

Debugging is an important in any development environment. By using the debug we will be able to solve the problem quickly and easily. It also reduces the extra outputs that will be added to the coding, which generally result in the removal of those codes at the End Minute, which might some times results in the Bugging of the entire code.

Like any other IDE’ Eclipse is also provided with the Debug option, so that the java files can be debugged easily and quickly. With that Debug ption, we can debug even the servlets running on the server. The only requirement is that we must have the source code and the server must be running in the Debug Mode.

Here, I am going to use Weblogic 8.0 as the Server.

First we have to edit the Startup Script for StartWeblogic.cmd or StartDocumentum.cmd. At the last of the script, we will be finding the Statement as Below.---------------------------------------------------------------------------------------------------------
%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -Dweblogic.Name=%SERVER_NAME% -Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE% -Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy" weblogic.Server---------------------------------------------------------------------------------------------------------

Replace the above line with the below line

%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=7001 -Dweblogic.Name=%SERVER_NAME% -Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE% -Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy" weblogic.Server
After this modification, when we try to start the server, the Screen will be displayed as fallows.


The Sever will be immediately suspended and it will wait for the Client Program like Eclipse to connect to them.








In the Eclipse, we need to run the application in Debug mode. For this we need to select the RUN->Debug, from the menu. Then we have to select Remote Java Application. In that, we have to specify the port, where the server is running. Here we have to specify the Port No 7001. Then the Debug has to be pressed.