Debugging

From OpenCms Wiki
(Difference between revisions)
Jump to: navigation, search
(Described setup of remote debugging in Eclipse)
 
 
(2 intermediate revisions by one user not shown)
Line 13: Line 13:
  
 
Defaults:
 
Defaults:
* JPDA_TRANSPORT default is dt_socket
+
* JPDA_TRANSPORT: dt_socket
* JPDA_ADDRESS default is 8000
+
* JPDA_ADDRESS: 8000
  
 
When Tomcat is started this way, you can attach your debugger in your IDE to the running Tomcat JVM process.  
 
When Tomcat is started this way, you can attach your debugger in your IDE to the running Tomcat JVM process.  
Line 20: Line 20:
 
== Eclipse setup ==
 
== Eclipse setup ==
  
If you have the OpenCms source code in an Eclipse project you can easily set breakpoints and debug the running OpenCms.
+
If you have the OpenCms source code in an [[Eclipse_integration|Eclipse project]] you can easily set breakpoints and debug the running OpenCms.
  
Create a new debug configuration in Run/Debug.../Java Remote Application, enter a name, select the project which contains the OpenCms source code and make sure the port is correct. The defaults of Eclipse and Tomcat are identical so you do not have to customize anything else than the name.
+
Create a new debug configuration in Run/Debug.../Remote Java Application:
 +
* enter a name,  
 +
* select the project which contains the OpenCms source code
 +
* make sure the port is correct. (The defaults of Eclipse and Tomcat are identical so you normally do not have to customize it)
  
After that, set a breakpoint and run the debug configuration.
+
After that, set a breakpoint and run the debug configuration. Eclipse then attaches to the remote running Tomcat process and will show the current stack in the Debug perspective.
 +
 
 +
 
 +
On linux make sure, Eclipse has all the necessary rights.

Latest revision as of 13:55, 6 November 2008

Remote debugging

You can easily debug OpenCms within your IDE if it supports remote debugging. Your Servlet Container needs to be started with JPDA (Java Platform Debugger Architecture) support enabled. To achieve this for Tomcat, simply start it with

catalina.sh|bat jpda start

instead of

catalina.sh|bat start

For Tomcat, the jpda option enables the following startup options to the JVM:

-Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=n

Defaults:

  • JPDA_TRANSPORT: dt_socket
  • JPDA_ADDRESS: 8000

When Tomcat is started this way, you can attach your debugger in your IDE to the running Tomcat JVM process.

Eclipse setup

If you have the OpenCms source code in an Eclipse project you can easily set breakpoints and debug the running OpenCms.

Create a new debug configuration in Run/Debug.../Remote Java Application:

  • enter a name,
  • select the project which contains the OpenCms source code
  • make sure the port is correct. (The defaults of Eclipse and Tomcat are identical so you normally do not have to customize it)

After that, set a breakpoint and run the debug configuration. Eclipse then attaches to the remote running Tomcat process and will show the current stack in the Debug perspective.


On linux make sure, Eclipse has all the necessary rights.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox