old-www/HOWTO/Enterprise-Java-for-Linux-H...

192 lines
6.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Enterprise Java for Linux HOWTO: How to Setup Java Servlet Support </TITLE>
<LINK HREF="Enterprise-Java-for-Linux-HOWTO-5.html" REL=next>
<LINK HREF="Enterprise-Java-for-Linux-HOWTO-3.html" REL=previous>
<LINK HREF="Enterprise-Java-for-Linux-HOWTO.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="Enterprise-Java-for-Linux-HOWTO-5.html">Next</A>
<A HREF="Enterprise-Java-for-Linux-HOWTO-3.html">Previous</A>
<A HREF="Enterprise-Java-for-Linux-HOWTO.html#toc4">Contents</A>
<HR>
<H2><A NAME="sec: servlet"></A> <A NAME="s4">4. How to Setup Java Servlet Support </A></H2>
<P>
<P>There are several Web Server plug-ins and Application Servers available
for Linux that provide support for Java Servlets. These include:
<UL>
<LI>
<A HREF="#sec: jrun">Allaire JRun</A></LI>
<LI>
<A HREF="#sec: jserv">Apache Tomcat</A></LI>
<LI>
<A HREF="#sec: weblogicservlet">BEA WebLogic</A></LI>
<LI>
<A HREF="#sec: enhydra">Enhydra</A></LI>
<LI>
<A HREF="#sec: locomotive">Locomotive</A></LI>
<LI>
<A HREF="#sec: websphere">IBM Websphere </A></LI>
<LI>
<A HREF="#sec: jettyservlet">Jetty</A></LI>
</UL>
<P>
<H2><A NAME="sec: jrun"></A> <A NAME="ss4.1">4.1 Allaire JRun</A>
</H2>
<P>
<P>To be written.
<P>See
<A HREF="http://www.allaire.com/products/jrun/">http://www.allaire.com/products/jrun/</A>for
more information.
<H2><A NAME="sec: jserv"></A> <A NAME="ss4.2">4.2 Apache Tomcat </A>
</H2>
<P>
<H3>Background </H3>
<P>JServ has been replaced with Tomcat from the Apache Jakarta project:
<A HREF="http://jakarta.apache.org/">http://jakarta.apache.org/</A>.
This section is still written for JServ and needs to be updated.
<P>Apache JServe is a 100% pure Java servlet engine fully compliant
with the Java Servlet 2.0 specification. Apache JServ is part of the Java
Apache Project. (From the Apache Java Project website).
<H3>Download </H3>
<P>
<P>Apache JServ can be obtained from
<A HREF="http://java.apache.org/jserv/index.html">http://java.apache.org/jserv/index.html</A>.
<P>
<P>>From the Apache JServ Project home page, follow the Download Apache JServ
link.
<P>Currently RPM distributions are available for RedHat Linux. For other
Linux distributions you will have to build from source. The following example
describes how install the RPM for RedHat 6x.
<P>As of the time of this writing, the current version is 1.1b3.
<H3>Installation </H3>
<P>
<P>I suggest installing files in the /usr/local directory. After downloading
the files, run:
<PRE>
mkdir /usr/local/apachejserv
mv ApacheJServ*.rpm /usr/local/apachejserv
</PRE>
<P>For RedHat and RedHat-derived distributions, use the RedHat Package Manager
(RPM) to install the rpm file such as:
<PRE>
rpm -i ApacheJServ-1.1-b2_RH6x.i386.rpm
</PRE>
<P>The above example shows version 1.1-b2 for the RedHat 6x on the Intel architecture.
<P>
<H3>Setting up Your Environment </H3>
<P>
<P>You will need to stop, set your Java environment variables, and restart
Apache to register Apache JServ.
<P>To stop Apache, type:
<PRE>
cd /etc/rc.d/init.d
./httpd stop
</PRE>
<P>Note: The httpd script used at boot time may be in a different location
on other Linux distributions
<P>To set you Java environment, see the How to Install the JDK section of
this document, specifically for the JDK you intend to use. You need to set
several properties in the jserv.properties file installed in /etc/httpd/conf/jserv.
Specifically, look for:
<UL>
<LI>wrapper.bin - to reference the JDK you installed </LI>
<LI>wrapper.classpath - to minimally include /usr/lib/apache/ApacheJServ.jar
and /home/httpd/classes/servlet-2.0.jar </LI>
<LI>bindaddress=localhost </LI>
<LI>port=8007 </LI>
</UL>
<P>To restart Apache, type:
<PRE>
cd /etc/rc.d/init.d
./httpd start
</PRE>
<H3>Confirming Your Installation </H3>
<P>
<P>To confirm that the Apache JServ is installed and running on your computer,
open your web browser, and enter the URL: &quot;http://127.0.0.1/servlet/IsItWorking&quot;
substituting the correct IP address if you are browsing from another machine.
<P>
<P>You should see a web page to the effect of &quot;Yes, It's Working!&quot;.
Contratulations, you have installed, set up an environment for, and tested
the Apache JServ for Linux.
<P>For more assistance, I suggest you look into the Apache JServ website at
<P>
<A HREF="http://java.apache.org/jserv/index.html">http://java.apache.org/jserv/index.html</A>.
<P>
<P>Now, to compile and run your own servlet. Enter the following Java servlet
program.
<PRE>
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorldServlet extends HttpServlet {
public void service (HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
}
}
</PRE>
<H3>More Information</H3>
<P>
<P>For more information, I suggest you look into the Java Apache Project website
at
<A HREF="http://java.apache.org/">http://java.apache.org/</A>.
<P>
<H2><A NAME="sec: weblogicservlet"></A> <A NAME="ss4.3">4.3 BEA WebLogic </A>
</H2>
<P>
<P>See
<A HREF="Enterprise-Java-for-Linux-HOWTO-7.html#sec: weblogic">BEA WegLogic </A>below.
<H2><A NAME="sec: enhydra"></A> <A NAME="ss4.4">4.4 Enhydra</A>
</H2>
<P>
<P>To be written.
<P>See
<A HREF="http://www.enhydra.org">http://www.enhydra.org</A>for more
information.
<H2><A NAME="sec: websphere"></A> <A NAME="ss4.5">4.5 IBM WebSphere </A>
</H2>
<P>
<P>To be written.
<P>See
<A HREF="http://www-4.ibm.com/software/webservers/appserv/linux.html">http://www-4.ibm.com/software/webservers/appserv/linux.html</A>for
more information.
<H2><A NAME="sec: locomotive"></A> <A NAME="ss4.6">4.6 Locomotive</A>
</H2>
<P>
<P>To be written.
<P>See
<A HREF="http://www.locomotive.org/">://www.locomotive.org/</A>for
more information.
<P>
<H2><A NAME="sec: jettyservlet"></A> <A NAME="ss4.7">4.7 Jetty</A>
</H2>
<P>The Jetty HTTP server is a combined server and servlet container. Installation
of the HTTP server (see above) provides servlet support. More information
can be obtained via the demo server and tutorial installed with the HTTP server.
<P>
<P>
<HR>
<A HREF="Enterprise-Java-for-Linux-HOWTO-5.html">Next</A>
<A HREF="Enterprise-Java-for-Linux-HOWTO-3.html">Previous</A>
<A HREF="Enterprise-Java-for-Linux-HOWTO.html#toc4">Contents</A>
</BODY>
</HTML>