Debugging with Tomcat in Eclipse in 2.0
This Step's Objective
This step instructs you on how to debug platform project code using Eclipse and Tomcat.
Warning: Make sure you do not have another application using port 8080 on your computer; this is the default port for the Tomcat application server. While you can change the default port to something else, you do not want to unnecessarily complicate your installation because it makes it harder to test with later. If port 8080 is in use, temporarily shut down the application that is using it while you are running Tomcat.
These steps are for Eclipse versions 3.5.2 - for other versions, the correct configuration may require different options.
Configuring a Tomcat Server in Eclipse using Sysdeo Eclipse Tomcat Launcher
- Follow steps 1 through 4, which take you through setting up your development environment, checking out the projects from Subversion and resolving your dependencies for building.
- Download XMLTask, a third-party Ant task. If building from the command line, download the JAR and copy into <user.home>/.ant/lib. If building from Eclipse, download the JAR and add it to the classpath of the Ant plugin (Window > Preferences > Ant > Runtime > Classpath).
To configure a new Tomcat 6.x server in the Eclispe IDE:
1. Create dev_override.properties in the bi-platform-build directory.
2. Add the property tomcat.dir and make the value the absolute path to your unzipped Tomcat installation. e.g.
Don't include spaces in the directory name and be sure to use forward slashes in the path.
3. Run ant -f dev_build.xml dev-rebuild in the bi-platform-build directory. This can also be done in Eclipse by opening
dev_build.xml in the editor and in the outline pane, right click dev-rebuild and select Run As->Ant Build.
4. Browse to http://www.eclipsetotale.com/tomcatPlugin.html and follow the instructions to download and install the Sysdeo
Eclipse Tomcat Launcher.
5. Start/Restart Eclipse and navigate to Window/Preferences/Tomcat.
- Select Tomcat Version 6.x.
- "Tomcat Home" is the location of the Tomcat installation under the
[workspace]/tomcat-pci-test/biserver-ce/tomcat directory created in step 3.
- The "Contexts directory" is the \conf\Catalina\localhost directory under "Tomcat Home".
6. Add the VM arguments, -Xms512m -Xmx1028m -XX:MaxPermSize=256m, to the Tomcat JVM Settings.
Note the "Don't run Tomcat in debug mode" checkbox.
7. Ensure that the "Tomcat Source Path" includes all bi-platform java projects.
8. Save and close the properties window.
9. Make sure you have the proper database server configuredand started. (Out of the box, this configuration will work with
the Hypersonic database which start script is located under tomcat-pci-test\biserver-ce\datain your Eclipse
10. Start Tomcat using the Plugin's "Start Tomcat" toolbar button. The server will start in debug as long as the
"Don't run Tomcat in debug mode" check box in the Window/Preferences/Tomcat/JVM dialog is unckecked.
Verify Debug Mode Works
To verify that the server is running in debug mode:
- Set a breakpoint on the first line of the executeAction() method.
- In a Web browser, login to the Pentaho PCI.
- The Eclipse IDE should indicate a breakpoint has been hit.
- If the following error and stack trace appear when the server is started:
Then it indicates a system parameter's default value will not work for the installed operating system. To correct this problem, the following system property should be set in the launch configuration of the server (the Argument tab's VM arguments edit box). Note that the directory specified (/tmp/ in this example) should be a temporary directory that currently exists on the system.