Before you configure Tomcat, you need to look at several concepts:
1. Server:
Physically, the server is a PC. Basic configuration: 8-core processor, more than 8G of memory, hard disk storage in T units, bandwidth 100M or more.
There are several common types of servers:
1) Web server: The PC is installed with a Web service software called a Web server.
2) database server: The PC is installed with a data management service software, called the database server.
3) Mail server: PC installed a software with Send mail service, called mail server.
2. Common Web Services Software:
1) Weblogic:bea Company's products, charges. Supports the Java EE specification.
2) WEBSPHERE:IBM Company's products, charges. Supports the Java EE specification.
3) Jboss:redhat Company's products, charges. Supports the Java EE specification.
4) Tomcat: Open source organization Apache products, free of charge. Support for part of the Java EE specification (SERVLET,JSP,JDBC, not supported Ejb,rmi not supported).
Note: Javase specification, contains IO stream, thread, set, socket programming ....
3, the role of Web services software: The local resources to share to external device access.
4, the basic use of Tomcat
1)
Apache official website: www.apache.org; Download page: http://jakarta.apache.org
2) Version classification
Installation version: window under Exe,msi file; Linux under RMP file.
Compressed version: Window under Rar,zip file; Linux under Tar,tar.gz.
3) Start and close Tomcat
To start the software:
<1>windows find%tomcat%bin/startup.bat, double-click the file.
MacOSX Find%tomcat%bin/startup.sh, double-click the file.
<2> pop-up terminal window, Windows do not close the window, close the window server shut down. When you close the window under MacOSX, Tomcat is still running.
<3> Open the browser, enter the address: http://localhost:8080, display a cat's picture, to prove that the software started successfully.
To close the software:
<1>windows find%tomcat%bin/shutdown.bat, double-click the file.
MacOSX Find%tomcat%bin/shutdown.sh, double-click the file.
<2> Open the browser, enter the address: http://localhost:8080, see "Unable to connect" to prove that the software is closed. (It's best to clear the browser cache here)
The terminal starts and closes TOMCAT:CD into the%tomcat%/bin file, executes $./startup.bat or startup.sh to open the service, executes $./shutdown.bat or shutdown.sh shuts down the service.
Commands used in the terminal for Tomcat operations:
View the Tomcat process: $ps-ef|grep Tomcat
Force kill Tomcat Process: $kill-9 Process number
View Port occupancy: Lsof-i Tcp:port For example: Lsof-i tcp:8080
4) Tomcat directory structure:
|-bin: The command to store Tomcat.
Catalina.bat command:
Startup.bat-Catalina.bat Start
Shutdown.bat-> Catalina.bat stop
|-conf: storing Tomcat configuration information. Where the Server.xml file is the core configuration file.
|-lib: A jar package that supports the operation of the Tomcat software. There are also technical support packages, such as servlet,jsp
|-logs: Log information for the running process.
|-temp: Temp directory.
|-webapps: Shared Resource directory. Web App Catalog. (Note that it cannot be shared with a separate file)
The running directory of the |-work:tomcat. The temporary files generated by the JSP runtime are stored here.
5. Eclipse Configuration Tomcat (the following are the actions in MacOSX)
1) Open Eclipse Create dynamic Web Project
2) Adding a Tomcat server
Under Windows: Window->properties->server->runtime environments
Mac:eclipse-> Preferences->server->runtime environments
As follows:
Click Add
Select Server version, next
Configuration path, Finish
Since this server has been added, after the completion of the project will be more than one servers file, this file is stored in the added Tomcat server.
3) Join the JAR package in Tomcat
Right-click Project->properties->java Build Path->library Add the jar package in Tomcat.
4) Add the project to the server
5) Configure Tomcat
Double-click the server to configure
6) Open Server in eclipse
7) Enter the http://localhost:8080/file path in the browser to access the files in the Web project.
Eclipse Configuration Tomcat