Setup Tomcat + Eclipse Dev environment
A quick guide on how to get running:
Tomcat Setup
1) Get your preferred tomcat version from here. In this example I picked 5.x (specifically 5.5.23). Get the 2 zip files Core and Admin (only needed if you want to use the admin app)
2) Unzip these files to /usr/local (typical unix location) ,change the attrib for .sh scripts to 755 (executable) and create a symlink for tomcat so you easily can move between versions:
cd /usr/local
gunzip apache-tomcat-5.5.23.zip
gunzip apache-tomcat-5.5.23-admin.zip
ln - s /usr/local/apache-tomcat-5.5.23 /usr/local/tomcat
cd tomcat/bin
chmod 755 *.sh
For more fancy readers - you can setup a special tomcat account and change owner of the whole tomcat dir to tomcat.
3) Create a user with the admin and manager roles to the default user database in $CATALINA_HOME/conf/tomcat-users.xml - example
role rolename="manager"
role rolename="admin"
user username="admin" password="changeme" roles="admin,manager"
4) Configure tomcat admin and manager to only accept local requests (just in case you're wide open on the internet..):
Tomcat Setup
1) Get your preferred tomcat version from here. In this example I picked 5.x (specifically 5.5.23). Get the 2 zip files Core and Admin (only needed if you want to use the admin app)
2) Unzip these files to /usr/local (typical unix location) ,change the attrib for .sh scripts to 755 (executable) and create a symlink for tomcat so you easily can move between versions:
cd /usr/local
gunzip apache-tomcat-5.5.23.zip
gunzip apache-tomcat-5.5.23-admin.zip
ln - s /usr/local/apache-tomcat-5.5.23 /usr/local/tomcat
cd tomcat/bin
chmod 755 *.sh
For more fancy readers - you can setup a special tomcat account and change owner of the whole tomcat dir to tomcat.
3) Create a user with the admin and manager roles to the default user database in $CATALINA_HOME/conf/tomcat-users.xml - example
role rolename="admin"
user username="admin" password="changeme" roles="admin,manager"
4) Configure tomcat admin and manager to only accept local requests (just in case you're wide open on the internet..):
$CATALINA_HOME/conf/[enginename]/[hostname]/manager.xml add this within the segment
valve classname="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1" valve
Repeat the same for
$CATALINA_HOME/conf/[enginename]/[hostname]/admin.xml
5) Setup a simple webserver access log so you can track who's on your site: In $CATALINA_HOME/conf/server.xml add this line within the Engine default host:
6) Start tomcat using the bin/startup.sh and /bin/shutdown.sh scripts and go to http://localhost:8080/manager - provide uid/pwd as per above and you should see the manager app.
Integrating w Eclipse
Debugging simple HTTP+javascript apps using local OS X apache:
A) Install the Ajax Toolkit framework (ATF) for nice debugging of ajax apps and javascript in Firefox/Mozilla - detailed instructions on the eclipse site - summary here:
1) Download ATF build to local
2) Help -> Software Updates -> Find and Install...
3) Select Search for new features to install then Select Next then Select New Archived Site...
4) Select the location of the downloaded update site zip file then Select Finish
5) Make sure all ATF features are selected and Follow the remaining prompts to install ATF
6) restart elipse form cmdline using eclipse - clean and close. Then start normally
B) Setup eclipse to use debug apps using mozilla+apache:
1) Setup a new HTTP server resource prefs->server->installed runtimes->add HTTP - suggest you define a prefix so that all your HTML projects get deployed into a specific directory mapped somewhere in local disk
2) Edit httpd.conf to setup new document root that map the prefix to some directory on your local HD
Now debug Tomcat JSP apps:
1) Get com.sysdeo.eclipse.tomcat_3.2.1 - copy into plugin directory
2) Start Eclipse and go to Preferences-> tomcat and configure the tomcathome plugin for 5.x
3) Pref->Server->Install runtime Apache Tomcat 5.5.x
4) Create HelloWorld.jsp using New->Project->Web->DynamicWeb
Debugging:
To-DO: how to run w external tomcat/deploy WARs to have well known
Optional: Eclipse cal also start tomcat within eclipse - in this case the content root is something like ~/eclipse_workspace/.metadata/.plugins/org.eclipse.wst.server.core
more details later..

0 Comments:
Post a Comment
<< Home