pavement

Tomcat

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
m (Versions=)
m (Setup Environment Variables)
 
(One intermediate revision by one user not shown)
Line 39: Line 39:
 
Editing /etc/profile
 
Editing /etc/profile
 
  JAVA_HOME=/usr/local/diablo-jdk1.5.0; export JAVA_HOME
 
  JAVA_HOME=/usr/local/diablo-jdk1.5.0; export JAVA_HOME
  CATALINE_HOME="/usr/local/tomcat5.5"; export CATALINE_HOME
+
  CATALINA_HOME="/usr/local/tomcat5.5"; export CATALINA_HOME
  CATALINE_BASE="/usr/local/tomcat5.5"; export CATALINE_BASE
+
  CATALINA_BASE="/usr/local/tomcat5.5"; export CATALINA_BASE
  CATALINE_TMPDIR="/usr/local/tomcat5.5/temp"; export CATALINE_TMPDIR
+
  CATALINA_TMPDIR="/usr/local/tomcat5.5/temp"; export CATALINA_TMPDIR
 
   
 
   
 
  CLASSPATH="/sbin:/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/tomcat5.5/common/lib/servlet-api.jar:
 
  CLASSPATH="/sbin:/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/tomcat5.5/common/lib/servlet-api.jar:

Latest revision as of 15:44, 21 October 2006

Tomcat is used as a server to run Java Servlets. It can be used stand alone or through Apache. Java Servlets is a great language which is very flexible. You can perform balance loading and connect to many great database engines such as postgres. There are many frameworks which you can use to speed up development and keep your code organised, a popular framework is 'struts'.

In this document I will explain how to setup jakarta-tomcat-5.5

Contents

[edit] Installation

[edit] Versions

The packages and version numbers I will be installing/working with here are:

  • FreeBSD 6.1
  • jakarta-tomcat-5.5.17_1
  • jakarta-struts 1.2.4
  • apache-ant-1.6.5_1
  • diablo-jdk-freebsd6.i386.1.5.0.07.00
  • PostgreSQL 8.1.4
  • KATE 2.5.3

    [edit] Install Java

    cd /usr/ports/java/diablo-jdk15/ && make install clean Java will require you to download a heap of files separately through the browser and place them in /usr/ports/distfiles

    [edit] Install Tomcat

    Install tomcat from ports as the post-install scripts help configure the system faster.

    1. cd /usr/ports/*/tomcat55
    2. make install

    [edit] Install ANT

    Used for compiling

    1. pkg_add -r apache-ant

    [edit] Configure

    There is a lot of configuration and tests which you can do in tomcat. Here I'm going to show a basic setup in which you should be able to start some projects.

    [edit] Startup

    If you want all the servers to load up on boot here is what you have to add to /etc/rc.conf

    tomcat55_enable="YES"
    postgresql_enable="YES"
    


    [edit] Setup Environment Variables

    Editing /etc/profile

    JAVA_HOME=/usr/local/diablo-jdk1.5.0; export JAVA_HOME
    CATALINA_HOME="/usr/local/tomcat5.5"; export CATALINA_HOME
    CATALINA_BASE="/usr/local/tomcat5.5"; export CATALINA_BASE
    CATALINA_TMPDIR="/usr/local/tomcat5.5/temp"; export CATALINA_TMPDIR
    
    CLASSPATH="/sbin:/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/tomcat5.5/common/lib/servlet-api.jar:
    /usr/local/tomcat5.5/common/lib/jsp-api.jar:.";export CLASSPATH
    

    [edit] Tomcat Servlet Reloading

    So that your modifications are automatically reloaded on your development box edit: /usr/local/tomcat5.5/conf/context.xml and change:

    <Context>
    

    to

    <Context reloadable="true">
    

    [edit] First time startup

    To start the tomcat server for the first time here is what you do:

    shell# cd /usr/local/tomcat5.5/bin
    shell# bash
    shell# JAVA_HOME=”/usr/local/diablo-jdk1.5.0”;export JAVA_HOME
    shell# ./startup.sh
    

    [edit] Using Tomcat

    The default for tomcat is http://<ip>:8180 (used to be on port 8080)

    The work area is /usr/local/tomcat5.5/webapps

    You can enter project_name.war files into the webapps directory then access them like so:

    http://<ip>:8180/project_name
    
  • Personal tools