Tomcat Java

zhaozj2021-02-16  93

Head: Integration under Windows2000 Apache2 and Tomcat4 Author: robornet Date: 2002-10-30 reason: to engage in a java project for some time, and that time distribution, and can not find a copy of the latest Apache2 integration and configuration of Tomcat4, then After reading the Jakarta online information for a long time, refer to the previous netizen's article, wrote this configuration document, for reference, welcome ax! Directory: First, Software Preparation II, Software Installation 3, First Configuration and Test 4, Integrated Configuration 5. All-line Test Six, Level 7, Thanks Eight, Description Steps: First, Software Preparation: Suppose You have a hard Win2000 Software environment. 1.j2sdk1.4.1: to http://java.sun.com/j2se/1.4.1/download.html download! (Note is the SDK version of Windows (All Languages, Including English) 2.Apache2.0.43: to http://www.apache.inetcosmos.org/dist/httpd/binaries/win32/apache_2.0.43-win32- x86- NO_ssl.msi download! 3.Tomcat 4.1.12: to http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.1/bin/jakarta-tomcat-4.1.12.exe download! 4.MOD_JK.DLL: to http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/v1.2.0/bin/win32/mod_jk-2.0.42.dll download! (Instead, since mod_jk2-2.0.43.dll is not successful and Apache2.0.43 configuration, use mod_jk-2.0.42.dll instead) Second, software installation: (1) Install J2SDK: 1. Install according to the installation wizard (general Installing to C: /J2SDK1.4.1, convenient below) (2) Install Apache: 1. Install according to the installation wizard (select the installation directory to c: /, convenient below; after the installation is successful, its path is: C: / Apache2) (3) Install Tomcat: 1. Install according to the installation wizard (Change the installation directory to c: / tomcat4, if it is just a test, there is no need to install Tomcat to Services, which is convenient for you to enter admin (system) The password of the administrator). Third, the first configuration and test: the first time the software environment installed, and the environment is tested.

(1) Configuration - Environment Variable: 1. New System Variable Java_Home, its value is: c: /j2sdk1.4.1 // If you do not press the above path to install, change to the correct path 2. New system variable tomcat_home, its value To: c: / tomcat4 //, the new system variable ClassPath, its value is:% java_home% / lib;% Tomcat_home% / lib (2) Modify error: 1.Apache2.0.43 has a small problem, default installation success There is no index.html file in the HTDOCS directory under the home directory of Apache2, you must rename index.html.en in this directory to INDEX.HTML (3) Test default service: please run apache2 and tomcat4. 1. Open The browser enters: http: // localhost test: You can see the welcome interface of Apache2 at this time. Description Apache2 works fine. (Note that the Tomcat default port is 80, if there is other programs, Please change, hereby instructions below) 2. Open the browser and enter: http:// localhost: 8080 in the address bar: You can see Tomcat's welcome interface in your browser. Description Tomcat works fine. (Note, Tomcat default port is 8080, if there is any other program occupied, please change, the following is explained below: If there is no error in this step, then the following operations, let 'go! (4) Test your item: Now Test your project with Tomcat, for convenience, assuming that you have a project in the E: / Application / OA directory (including index.jsp and other JSP files and beans, such as WEB-INF / CLASSES / SERVLET Javabean. 1. Set Tomcat to support your project, open the c: /tomcat4/conf/server.xml file, add and save it after "before," ".

Description: Context (Represents a web application): DOCBASE defines the path to the application; Path represents the prefix of the URL of this web application, so the requested URL is http: // localhost: 8080 / OA;

This property is very important. If true, Tomcat automatically detects the application's / web-inf / lib and / web-inf / class directory change, automatically loads a modified or new bean.

And servlet, we can see the BEAN to change to JSP without restarting Tomcat.

2. Start your Tomcat 4.1.12, enter http: // localhost: 8080 / OA in the browser address, such as your JSP and Bean, servlets have no errors, usually make your index.jsp / index.html file

The content is executed and displayed.

Summary: If there is no error in this step, then continue below, let 'go!

Fourth, integrated configuration:

Do the appropriate configuration for Apache and Tomcat to work together for you.

If Apache2 is running with Tomcat4, close them.

(1) Configure Apache2:

1. Copy the downloaded mod_jk-2.0.42.dll to C: / Apache2 / Modules first.

2. Set the home page file type: Open httpd.conf under C: / Apache2 / Conf, find "DirectoryIndex", add index.jsp after index.html, save, pay attention to each other.

3. Set the virtual host, let Apache automatically control the resolution of HTML and JSP: Open C: /Apache2/conf/Httpd.conf, add the following segment and save.

// localhost is this machine, you can use this unit IP

ServerAdmin robornet@robornet.com // Your mail address

DocumentRoot E: // Your project group root directory, because there is OA and other multiple items under Application, so you can only be set to E: / Application

ServerName Localhost // Your service name, if your machine has domain name, set it to domain name, but now this machine is test

ERRORLOG logs / robornet_home_log.txt // Error log, under C: / Apache2 / logs, other names available

CustomLog logs / robornet_custom_log.txt common // Access log, under C: / Apache2 / logs, other names available

4. Set the connection between Apache and Tomcat, let Apache encountered the JSP file, put it in the background to process it: Open C: /Apache2/conf/httpd.conf, add the following section below and save .

# @ Uings_jk2.dll to redirect Dynamic Calls to Tomcat

LoadModule JK_Module Modules / MOD_JK-2.0.42.dll // Loading Module for processing connection

JKWorkersFile "c: /tomcat4/conf/Workers.properties" // Sets the module's work file, below

JKLogfile "c: /tomcat4/logs/mod_jk2.log" // Set the log file working by the module, TOCMAT will be built

JKMount / Servlet / * AJP13 / / Let Apache support to send servlet to Tomcat resolution

JKMount /*.jsp Ajp13 // Let Apache support to transfer to JSP for Tomcat resolution

Summary: The configuration of this apache is basically completed, but the Apache is not working properly at this time.

(2) Configure Tomcat4:

1. New file workers.properties under C: / Tomcat4 / Conf pay attention to the file suffix, it is recommended to use EditPlus or UltraEdit, if you use notepad, remember to change your name,

Don't become workers.properties.txt! The content is as follows: workers.tomcat_home = c: / tomcat4 // Let the mod_jk module know Tomcat

Workers.java_home = c: /j2sdk1.4.1 // Let the Mod_JK module know J2SDK

PS = /

Worker.list = ajp13 // module version, existing AJP14, do not modify

Worker.ajp13.port = 8009 // Work port, if you don't take it, you don't have to modify it.

Worker.ajp13.host = localhost // This machine, if the above Apache host is not localhost, make a corresponding modification

Worker.ajp13.type = ajp13 // Type

Worker.ajp13.lbFactor = 1 // Agent number, no modification

2. Open the server.xml file under C: / Tomcat4 / Conf: Find "

", Put the previous code:

MINPROCESSOORS = "5" maxprocessors = "75" enablelookups = "true" redirectport = "8443"

Acceptcount = "10" debug = "0" connectionTIMEOUT = "20000" UseriValidationHack = "false"

ProtocolHandlerclassName = "org.apache.jk.server.jkcoyotehandler" />

change to:

MaxProcessors = "75" acceptcount = "10" debug = "0" />

It is saved and closed.

Summary: Brothers must be tired! Ok, you can come to a cup of Java, enjoy your results!

Five, full line test:

1. Start Apache2, Tomcat4.

2. Open your browser and enter http: // localhost: 8080 / oa in the address bar. If the Tomcat is normal!

3. In the address bar

转载请注明原文地址:https://www.9cbs.com/read-12135.html

New Post(0)