Hitachi Vantara Pentaho Community Wiki
Child pages
  • 08. Debugging with Tomcat in Eclipse IDE in 2.0
Skip to end of metadata
Go to start of metadata

Debugging with Tomcat in Eclipse in 2.0

Now you will place a breakpoint in the platform Java code, run the 'Hello World' sample solution, and step through the code from that breakpoint.

(warning) 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.

IDE Version

These steps are for Eclipse version 3.3.1 - for other versions, the correct configuration may require different options

Configuring a Tomcat Server in Eclipse

Prerequisites

  •    Download and unzip Apache Tomcat 5.5 or greater.
  •    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 5.5 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.
  3. Run ant -f dev_build.xml dev-rebuild in the bi-platform-build directory.
  4. In Eclipse, go to the Window menu and click on Preferences.
  5. Open the Server item and click on Installed Runtimes selection.
  6. Click Add...
  7. In the New Server Runtime dialog, select Apache from the list and select the sub-item Apache Tomcat V5.5 and then click Next >
  8. On the Tomcat Server page of the dialog, set the Tomcat installation directory to be the tomcat directory under the tomcat-pci-test\biserver-ce directory (this is the directory gets created by the dev-rebuild and it is located inside your Eclipse workspace).
  9. Click Finish, then click OK in the Preferences dialogue.
  10. Open the Server window in Eclipse by going to the Window menu, then selecting Show View, then Other, then Server, then Servers.
  11. In the Server window, right-click and select New, then Server.
  12. In the New Server dialogue, make sure the following fields are set correctly:
    1. Server's host name is localhost.
    2. Server type has Tomcat v5.5 Server selected.
    3. Server runtime is Apache Tomcat v5.5 (or the name that was assigned in step 5 above).
  13. Click Finish to create the server.
  14. Double-click on the newly created server (in the Servers window) to open the properties for that server.
  15. In the Server Locations section of the properties, make sure the Use Tomcat installation (takes control of Tomcat installation) option is selected.
  16. Click on the link titled Open launch configuration in the General section.
  17. In the Arguments tab of the dialogue, add the following to the VM arguments text box:
    -Xms512m -Xmx1028m -XX:MaxPermSize=256m
    
  18. In the Source tab of the dialog, click Add..., then add all the bi-platform... projects, then click OK.
  19. Click OK to save the changes and close the Launch Configuration dialogue.
  20. Save and close the properties window.
  21. Make sure you have the proper database server started. (Out of the box, this configuration will work with the Hypersonic database which start script is located under tomcat-pci-test\biserver-ce\data in your Eclipse workspace).
  22. With the new server highlighted, click on the Debug button to start the server in Debug mode.
  23. Once the server is running, open the following URL in a browser: http://localhost:8080/pentaho.

Verify Debug Mode Works

To verify that the server is running in debug mode:

  1. Open the source file org.pentaho.platform.plugin.action.examples.HelloWorldComponent in the bi-platform-plugin project (actions sub-project).
  2. Set a breakpoint on the first line of the executeAction() method.
  3. In a Web browser, login to the Pentaho PCI.
  4. In the Solution Repository, navigate to and run the Hello World action by clicking Go, then Solutions, then Getting Started, then Hello World.
  5. The Eclipse IDE should indicate a breakpoint has been hit.

Notes

  • If the following error and stack trace appear when the server is started:
13:32:36,259 ERROR [DiskStore] libloader-dataCache: Could not create disk store. Initial cause was Could not create cache directory "/tmp_pentaho".
java.lang.Exception: Could not create cache directory "/tmp_pentaho".
...

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.

-Djava.io.tmpdir=/tmp/
  • No labels