openxava / documentation / Eclipse Web Tools Platform

Table of contents

Eclipse Web Tools Platform
Add Tomcat to your Eclipse
Create a Tomcat server
Define your data sources
Start the server and test your application
Developing using WTP
This is a guide to configure WTP in order to execute and debug OpenXava applications inside Eclipse.
Eclipse Web Tools Platform (WTP) help you develop J2EE application with Eclipse.
In the case of OpenXava you can use WTP to start Tomcat (or your favorite Application Server) inside Eclipse, thus you can see the effects of the changes without redeploy and also you can debug your code.
All OpenXava applications created using OpenXavaTemplate are WTP compatible.
This document guide you to use WTP for executing the MySchool demo application that comes with OpenXava.

Add Tomcat to your Eclipse

Warning! If you use a Tomcat other than one that comes with OpenXava distribution then you must copy jta.jar and ejb.jar from openxava-3.0.x/tomcat/common/lib to the folder common/lib of your Tomcat.

Create a Tomcat server

Define your data sources

Now you have in your workspace a project named Servers. Inside this project you have a folder named Tomcat v5.5 Server @ localhost-config. Put there a file named context.xml with the next content:
<!-- The contents of this file will be loaded for each web application -->
<Context>
 
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
 
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<Manager pathname="" />
 
<Resource name="jdbc/OpenXavaDS" auth="Container" type="javax.sql.DataSource"
    maxActive="20" maxIdle="5" maxWait="10000"
    username="sa" password="" driverClassName="org.hsqldb.jdbcDriver"
    url="jdbc:hsqldb:file:/java/openxava-3.0/tomcat/data/openxava-db"/>
 
<Resource name="jdbc/MySchoolDS" auth="Container" type="javax.sql.DataSource"
    maxActive="20" maxIdle="5" maxWait="10000"
    username="sa" password="" driverClassName="org.hsqldb.jdbcDriver"
    url="jdbc:hsqldb:file:/java/openxava-3.0/tomcat/data/my-school-db"/>
 
</Context>
 

Remember to change /java/openxava-3.0 by the path where your have OpenXava installed.

Start the server and test your application

Developing using WTP

After the above steps if you change Java code then you only need to click on Build All (or Ctrl-B) and go to your browser to see your updated application. If you touch some XML file you need to execute the rebuild ant target, refresh your project and go to the browser to see the result.

Furthermore, you can start your Tomcat in debug mode and using the Eclipse debugger.