Java is becoming an even more popular for making diverse and scalable platform independent solutions. One of the most growing needs of Java is in the ASP (Application Service Provider) market. Java serves as the perfect solution for these types of markets, with the following advantages:
Industry Wide Commitment
Distributed, Multi-threaded, Secure etc.
A very important and growing technology which has emerged from Java is JSP (JavaServer Pages).
JSP (JavaServer Pages) is a server-side technology introduced by Sun Microsystems Corp., which provides a quick simple way to generate dynamic content from within HTML pages. It uses XML tags along with Java scriptlets to encapsulate and separate the logic from the design and display. When a JSP page is invoked, it is dynamically converted into a Servlet and processed by the server to produce the resulting HTML/XML page for the client. When JSP is used in conjunction with JavaBeans, it is possible to produce very diverse and scalable applications, which may be combined with the strength and performance of FreeBSD.
Tomcat is an open-source implementation of the Java Servlets and JavaServer Pages technologies, developed under the Jakarta project at the Apache Software Foundation. Tomcat implements a new Servlet framework (called Catalina) that is based on completely new architecture with the Servlet 2.3 and JSP 1.2 specifications. It includes many additional features that make it a useful platform for developing and deploying web applications and web services. In a nutshell, Tomcat is an application server written in 100% Pure Java.
Tomcat is used for many purposes, and is not limited to Application Servers. It provides an open platform to develop extensible web and content management services. When Tomcat is used with an optimized FreeBSD system, it can provide highly reliable and fast pacing services.
Please refer to the reference section for more information on Tomcat and JSP. The next section will demonstrate how to build the ``Tomcat Environment'' for FreeBSD. The version of Tomcat used in this guide is 4.0.3. This version contains major bug fixes, and the following updates/changes:
JSP 1.2 Specification
Java Servlet 2.3 Specification
Full backward compatibility with the Java Servlet 2.2 and JSP 1.1 Specification
It is very simple to install Tomcat on a FreeBSD machine, after setting up the necessary Java environment, which we have previously completed.
In-order to setup Tomcat on FreeBSD, follow the below procedure:
Follow the above steps to setup the necessary Java environment.
Set an environment variable JAVA_HOME which, points to the directory where you have installed the JDK (the examples below point to a native build of the JDK). If you are using sh(1) as your shell, you can set JAVA_HOME with:
# export JAVA_HOME="/usr/local/jdk1.3.1"
Those who use csh(1) or a compatible shell, must use a slightly different command:
# setenv JAVA_HOME /usr/local/jdk1.3.1
This environment variable should be made permanent by adding it into either .profile or .cshrc, depending on the shell you are using. This variable is very crucial for the functioning of all the Java based programs, including Tomcat itself.
Download the Tomcat ``binary distribution'' from the Jakarta website, which is located at http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.3/bin/. The file to download is called jakarta-tomcat-4.0.3.tar.gz.
The compressed and archived file we downloaded in the previous step uses special ``GNU Extensions''. In-order to untar and uncompress the file, we will need to install GNU Tar ( archivers/gtar), by doing the following:
# cd /usr/ports/archivers/gtar && make all install clean
Un-tar and Un-compress the jakarta-tomcat-4.0.3.tar.gz file into the /usr/local directory and rename the directory to tomcat-4.0 for ease of reference:
# cd /usr/local # gtar zxvf jakarta-tomcat-4.0.3.tar.gz # ls jakarta* jakarta-tomcat-4.0.3 # mv jakarta-tomcat-4.0.3 tomcat-4.0
You can remove the jakarta-tomcat-4.0.3.tar.gz at your preference.
Note: Installation by using the source code is currently out of scope for this document. Please refer to the following files for addition information on building from source, available from your Tomcat distribution directory:
Now that we have finished installing Tomcat. The following example shows how to start the Tomcat server:
# cd /usr/local/tomcat-4.0/bin # ./startup.sh (for starting Tomcat)
You can test if your Tomcat server has started by visiting the following URL: http://127.0.0.1:8080 or http://localhost:8080. To stop Tomcat:
# cd /usr/local/tomcat-4.0/bin # ./shutdown.sh
(for stopping Tomcat)
The startup.sh and shutdown.sh are frontends to the catalina.sh executable script in the same directory; if you would like to start Tomcat automatically at boot-time run:
# cd /usr/local/etc/rc.d # ln -s /usr/local/tomcat-4.0/bin/catalina.sh
Edit the catalina.sh, and add the following at the beginning of the file (after the comment box):
If your port 8080 is occupied by some other service, you can change it by editing the server.xml in your Tomcat's conf/ directory. In the example below, the port will be changed to 80, assuming there is no service running on that port.
# cd /usr/local/tomcat-4.0/conf # fgrep -n 8080 server.xml ~65: By default, a non-SSL HTTP/1.1 Connector is established on port 8080. ~89: port="8080" minProcessors="5" maxProcessors="75" # cat server.xml | sed s/8080/80/ > server.xml.new # mv server.xml.new server.xml.new
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the
before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.
Закладки на сайте
Проследить за страницей
Created 1996-2022 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру