diff --git a/en_US.ISO8859-1/articles/java-tomcat/Makefile b/en_US.ISO8859-1/articles/java-tomcat/Makefile new file mode 100644 index 0000000000..2b95b0060b --- /dev/null +++ b/en_US.ISO8859-1/articles/java-tomcat/Makefile @@ -0,0 +1,22 @@ +# +# FreeBSD Documentation Project +# $FreeBSD$ +# +# Makefile for "Java and FreeBSD First Steps" +# Author: Victoria Chan, Hiten Pandya + +MAINTAINER=vkchan@kendryl.net hiten@uk.FreeBSD.org + +DOC?= article + +FORMATS?= html + +INSTALL_COMPRESSED?= gz +INSTALL_ONLY_COMPRESSED?= + +# SGML content +SRCS= article.sgml + +DOC_PREFIX?= ${.CURDIR}/../../.. + +.include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/en_US.ISO8859-1/articles/java-tomcat/article.sgml b/en_US.ISO8859-1/articles/java-tomcat/article.sgml new file mode 100644 index 0000000000..4964e5bdf2 --- /dev/null +++ b/en_US.ISO8859-1/articles/java-tomcat/article.sgml @@ -0,0 +1,597 @@ + + + + + + + + + + + + + + +%man; +]> + +
+ + + + Java and Jakarta Tomcat on FreeBSD + + + + Victoria + Chan + +
vkchan@kendryl.net
+
+
+ + + Hiten + Pandya + +
hiten@uk.FreeBSD.org
+
+
+
+ + + 2002 + Victoria Chan + Hiten Pandya + + + $FreeBSD$ + + + This document is presented in hopes of making it easier for anyone that + needs to get Java up and running on FreeBSD, + with the least amount of aggravation. Plan on spending a whole day on + such a project as it will take time to assemble all the pieces and + compile them individually, and then as a whole. It also shows how to + install the famous Jakarta Tomcat Servlet and + JSP container on the FreeBSD operating system. + +
+ + + + Introduction + The Java programming language was birthed on + May 23rd 1995. One would expect that after all this + time, Java applications would be easy to install and ready to run from a + single package, or port on FreeBSD, thus making it available for the + masses. This is not the case, unfortunately, as the Java + distribution is held very closely by Sun Microsystems, and prohibits re-distribution. + All Java Applets must be compiled from source code, together with the Java + Development Kit from Sun Microsystems. All these ingredients + must be blended together in the right order, assembled, and compiled by + the end user. With such distribution philosophies at heart, it is my + opinion that Java will always be developer or hacker use only. I certainly + found this to be true when I needed to serve up some + .jsp pages for a client on my web server, and needed + to get www/jakarta-tomcat to work with + www/apache13 on my FreeBSD system. + + The Tomcat portion of the install is very straight forward, but the + difficulty I had was getting Java Development Kit up and running for + FreeBSD 4.x, as Sun Microsystems only supplies Binaries for Linux, + Solaris, and Windows NT. + This means that I had to compile my own JDK for FreeBSD. I began by + searching for documentation on the Internet. I quickly found that there + is more source code than I need along with patches to the source code, but very + little documentation of what to do after obtaining everything. + + In this article, you will find how to install the Java Development Kit + for FreeBSD, and how to get up and running with Tomcat. A + section is also provided for further reading. + + + + The Java Environment + Ensure that you have the current ports collection as + make it will fail if it attempts to build + older source. You can upgrade your entire ports collection by + using CVSup. See + for more information. You can also download the ports you need manually + from + to get you going. + + + You will need the Linux Emulation (Linux-ABI) + enabled in your kernel configuration. Simply add the following option + to your kernel configuration file and recompile it. Instructions for + building a kernel can be found in the FreeBSD Handbook. + + options COMPAT_LINUX + + The above option will add Linux-ABI support to your kernel, when + it is recompiled. + + + The list of dependencies below, are required to be installed manually + in a certain order. Dependencies that are automatically downloaded are not + listed here. + + + + java/jdk13 + + + + java/linux-jdk13 + + + + archivers/gtar + + + + archivers/bzip2 + + + + archivers/unzip + + + + archivers/zip + + + + You will need to get the following: + + + + Download bsd-jdk131-patches-5.tar.gz from + + and place it under /usr/ports/distfiles. + + + + Next get out your web browser and head on over to + + and find SDK downloads. Click on the continue button + below GNUZIP Tar Shell Script. Be sure you read every + word of the license page before you click on the Accept + button! You will be brought to a page titled Download Java(TM) 2 + SDK, Standard Edition 1.3.1_02. Scroll to the bottom and click on + the HTTP download button. When the File Download + box comes up, be sure to click on the Open button rather than the + Save button. You will be presented with another + File Download box - this time choose Save + and you will be able to save j2sdk-1_3_1_02-linux-i386.bin. + Place it in /usr/ports/distfiles. + + + + Go to . + In the table under Produce Description, named + Java 2 SDK 1.3.1, go to the right-hand cell and + click download. You will be taken to the Sign On + page, where you must sign in if you already have an account, or + register for access. Once you have signed on, you will be taken to the + Legal page, where you must accept the license agreement; + scroll down (reading the license) and click on the Continue + button. Next page, is the Receipt page. This is where you + will save you order number. You will be able to choose the location + that is nearest to you. Click on Java 2 SDK, Standard + Edition, version 1.3.1. Save the + j2sdk-1_3_1-src.tar.gz to the + /usr/ports/distfiles/ directory. + + + + It is very important for you to read the License Agreement which + has been issued by Sun Microsystems Corp. There are several restrictions + in place on the use of Java, which you must address. The FreeBSD Project + does not take any responsibilities for your actions. + + Do not discard any of the downloaded files, as they will be needed for + building some of the native ports for FreeBSD, which are discussed later + on. + + + Now that you have assembled all the source files and ports, you need + to start by building + java/linux-jdk13: + + &prompt.root; cd /usr/ports/archivers/gtar; make all install clean + + &prompt.root; cd /usr/ports/archivers/unzip; make all install clean + + &prompt.root; cd /usr/ports/archivers/zip; make all install clean + + And finally: + + &prompt.root; cd /usr/ports/java/linux-jdk13 + + &prompt.root; make all install clean + + Once you have built + java/linux-jdk13, you need to test + it, to make sure it works as intended. To do that: + + &prompt.root; cd /usr/local/linux-jdk1.3.1/bin + + &prompt.root; ./java-version + + The output of the above command should be as follows: + + java version "1.3.1_02" + Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02) + Classic VM (build 1.3.1_02-b02, green threads, nojit) + + If you did not get the correct response, you need to: + + &prompt.root; cd /usr/ports/java/linux-jdk13 + + &prompt.root; make deinstall + + And make sure that /usr/local does not contain a + linux-jdk1.3.1 directory. If you find a fragment of + the directory, delete it. Repeat the build and install + process for java/linux-jdk13. + + To make the native Java Development Kit 1.3.1 for + FreeBSD, do the following: + + + + Make sure you have the j2sdk-1_3_1-src.tar.gz + file in your /usr/ports/distfiles. This file is + needed for applying the patch-sets discussed below. + + + + You will need to download the patch set + for building the port. The patch-set file is called + bsd-jdk131-patches-6.tar.gz. You should also make sure + the integrity of the files by matching it with the following + MD5 checksum. The patch-set is called + Patch-set 6. + + + MD5 (bsd-jdk131-patches-6.tar.gz) = 9cade10b81d6034fdd2176bef32bdbf9 + + + The patch-set is available from: + + + + + The last procedure discussed above (building the native + jdk) will take some time. + + + + Jakarta Tomcat Setup + + Overview + 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: + + + + Platform Independence + + + + Industry Wide Commitment + + + + Scalability + + + + Reliable Performance + + + + + 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 and 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 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 + + + + + + The Tomcat environment for FreeBSD + 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 below + example points to a native build of the JDK): + + &prompt.root; setenv JAVA_HOME /usr/local/jdk1.3.1 (for C Shells) + + &prompt.root; export JAVA_HOME=/usr/local/jdk1.3.1 (for Bourne Shells) + + 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 + . 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: + +&prompt.root; cd /usr/ports/archivers & & 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: + + &prompt.root; cd /usr/local + + &prompt.root; gtar zxvf jakarta-tomcat-4.0.3.tar.gz + + &prompt.root; ls jakarta* + + jakarta-tomcat-4.0.3 + + &prompt.root; mv jakarta-tomcat-4.0.3 tomcat-4.0 + + You can remove the + jakarta-tomcat-4.0.3.tar.gz at your preference. + + + + + 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: + + + + /usr/local/tomcat-4.0/README.txt + + + + /usr/local/tomcat-4.0/BUILDING.txt + + + + + + + Operating Tomcat - Basics + Now that we have finished installing Tomcat. The following + example shows how to start the Tomcat server: + + &prompt.root; cd /usr/local/tomcat-4.0/bin + + &prompt.root; ./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: + + &prompt.root; cd /usr/local/tomcat-4.0/bin + + &prompt.root; ./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: + + &prompt.root; cd /usr/local/etc/rc.d + + &prompt.root; 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): + + JAVA_HOME=/usr/local/jdk1.3.1 + + 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. + + &prompt.root; cd /usr/local/tomcat-4.0/conf + + &prompt.root; 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" + + &prompt.root; cat server.xml | sed s/8080/80/ > server.xml + + + + + + Reference + + + + + + The FreeBSD Java Project + + + + + + JavaSoft. Home of Java + + + + + + The + Sun Community Source Licensing for Java + + + + + + Jakarta Tomcat Homepage + + + + + + J2SE + Documentation + + + + + + FreeBSD Ports - Java + Section + + + + + + + + + Conclusion + Finally, we are at the end of the article and have a working version of + Tomcat. We hope that you have learned the basics of installing and + building the Java Development Kit on FreeBSD, along with installation + of the Tomcat binary distribution application server released by the + Apache Software Foundation. The section + contains pointers to additional resources on this topic, some which + are in print, some which are on the World Wide Web, or both. + + The most important thing is drive space. I suggest having + 700MB or more free space in /usr. + I hope this article has helped you in some small way. For + questions, comments, compliments, or rants, please direct them to + Victoria Chan. + + +