1. Installation and operation "must"
* Decompression Apache-tomcat-6.0.35.zip
* Location: cannot contain Chinese and space
Run
%tomcat%/bin/startup.bat
* Test
* http://localhost:8080
2. Startup error
* Java_home system environment variable not configured
* Error Content
Neither the Java_home nor the JRE_HOME environment variable is defined
At least one of these environment variable are needed to run this program
* Configure Java_home if not pointing to the JDK directory
* Error Content
The JAVA_HOME environment variable is not defined correctly
This environment variable are needed to run
Nb:java_home should point to a JDK not a JRE
* Configure JDK
* Installation directory: C:\JAVA\JDK\JDK1.6.0_32
* Error message Location
*%tomcat%/bin/setclasspath.bat
* There must be 4 executable programs
If not exist "%java_home%\bin\java.exe" goto nojavahome
If not exist "%java_home%\bin\javaw.exe" goto nojavahome
If not exist "%java_home%\bin\jdb.exe" goto nojavahome
If not exist "%java_home%\bin\javac.exe" goto nojavahome
* Port is occupied
* Error Content
Exception: Java.net.BindException:Address already in Use:jvm_bind <null>:8080
3, modify the port number "must"
* Modify the location of the file
*%tomcat%/conf/server.xml
* Number of Modified ports: 3
* <server port= "8005" shutdown= "Shutdown" >
* <connector port= "8080" protocol= "http/1.1"
* <connector port= "8009" protocol= "ajp/1.3"
Note
A port number can only be occupied by one application
An application can occupy multiple port numbers
* Requirements: Change the port to 80, then modify it back to 8080
4. Tomcat directory structure
* Bin directory: The startup and termination scripts that hold Tomcat
* Startup.bat Startup script
* Bootstrap.jar, Startup script final Java program execution
* Org.apache.catalina.startup.Bootstrap
* Shutdown.bat Terminate Script
* conf directory: Files that hold all of Tomcat's configuration information "must"
* Tomcat-users.xml: Manage user rights
* Web. xml: To manually write website. xml
* Server.xml: Modify configuration (Modify port, add virtual path, add virtual Host)
* Lib directory: jar that holds all of Tomcat's features
* Tomcat:web server, servlet container
* Tomcat only implements JSP, servlet
* Java EE 13 core technology (PPT 8)
* Logs directory: Log directory
* Temp Directory: Temp folder
* WebApps directory: The directory where Tomcat maintains all Web applications is "must"
* ROOT--/
* Work directory: Tomcat processing JSP files working directory "must"
5. Configure Tomcat's Admin user "must"
* File Location
*%tomcat%/conf/tomcat-users.xml
* Add content
<!--Declare the roles you currently need--
<role rolename= "Manager-gui"/>
<!--determine the current user's account and password, and the role used--
<user username= "root" password= "root" roles= "Manager-gui"/>
* Restart Tomcat
6. Web Project "must"
| Web Project
| --Web-inf Directory: The resource directory to block browser access. This directory browser is not visible
* Store configuration information for Web projects
* Store Web project-dependent JAR files
* The class file generated by the source file of the current web
| --Web. xml file: A configuration file for a website project
* Contents of configuration information:%tomcat%/conf/web.xml, copy root element
| --lib directory: the location of the dependent jar file
| --Classes Directory: Where class files are stored
7. Virtual directory:
* File Location:%tomcat%/conf/server.xml
* Configuration Content
<context path= "/xxx" docbase= "F:\workspaces\20120909\day04\WebRoot"/>
* Path: Browser access paths
* DocBase: The actual folder location of the current path mapping
* Note: Specify to a Web project
* Purpose: Extend the WebApps Directory management project
8. Virtual Host
* Local domain name effective cause localhost
* C:\WINDOWS\system32\drivers\etc\hosts
* 127.0.0.1 localhost
* Hosts file
* Write URL to access resources
* The role of IP: only responsible for locating the desired host location
* Configuration Content
* Note: The host file needs to be modified
Use of Tomcat (i) (under Windows)