Tomcat Configuration and Installation


one Configure the environment

  1. D:/Tomcat(default port number of Tomcat is 8080)

  2. After the installation is complete, enter http://127.0.0.1:8080 in the browser to verify the installation

  3. Run close tomcat Open the Tomcat installation path, open the bin folder, and open the tomcat8w. exe file to run or shut down the service

Two, practical operation cases

  1. Place the mybatis. Zip file in D:\Tomcat\webapps

  2. Create a new mybatis001 database from mysql database

  3. Create a T_user table where user_id is int, 20 lengths, primary key, and auto-increment

User_age is of vARCHar type and the length is 30 and the null value is allowed. User_name is of vARCHar type and the length is 30 and the null value is allowedCopy the code

Use the SQL:

CREATE DATABASE mybatis001;
USE mybatis001;
CREATE TABLE t_user(user_id INT PRIMARY KEY,
user_age VARCHAR(30),
user_name VARCHAR(30));
Copy the code
  1. Mybatis compressed package, decompress, put in tomcat webapps

  2. In D: Tomcat\webapps\mybatis\ web-INF \classes\config, open the spring-common. XML file with notepad or editor. Then change the red part:

<! -- 1. Data Source: DriverManagerDataSource - > < bean id = "dataSource" class = ". Org. Springframework. JDBC dataSource. DriverManagerDataSource "> <property name= "driverClassName" value= "com.mysql.jdbc.driver" />< Property name= "URL" Value = "JDBC: mysql: / / 192.168.2.2:3306 / mybatis007" / > < property name = "username" value = "test050" / > < property Name = "password" value = "test050" / > 0 < / bean >Copy the code
  1. Under the bin directory of the tomcat start tomcat, enter http://localhost:8080/mybatis/index.jsp in your browser’s address bar

  2. If you modify any information on the web page, the database information changes synchronously

Tomcat problem

  1. What each subfolder in the Tomcat home directory represents:

Bin: stores the script files for starting and stopping Tomcat. Conf: stores configuration files of the Tomcat server. Lib: stores jar packages supported by the Tomcat server. Logs: stores Tomcat log files. Temporary cache files generated when Tomcat is running. Work: The working directory of Tomcat

  1. What is LAMP? What are static and dynamic requests

LAMP(Linux Apache middleware MySQL PHP) Static request: js CSS HTML GIF PNG image format dynamic request: in the address bar with? HTM. XML. Asp. JSP. PHP. Perl and so on

  1. Have you built a test environment yourself? (Can you build your own test environment?)

I can set up the test environment independently. Before I went to the company, the company had already set up the test environment. We have a complete manual for setting up the environment, such as installing JDK, Tomcat,mysql database, etc., configuring the corresponding environment variables, and then carrying out the corresponding configuration. Configure the server address, port number, maximum number of connections, Tomcat connections, etc. When configuring tomcat, find server. XML and web. Web. XML configures servlets for requests. And then deploy Linux test environment, development contract first, we use xshell (CRT) connect to the server, first stop service, backup on a version of the test package, to replace the current test package, then ready to start the service, prior to the start we need to query the tomcat port is being used, put the directory of packages whether it is right, etc., Check whether tomcat is correct, and check whether the startup log is normal. Finally, open the web page and enter the address. If the web page runs properly, the application is successfully deployed.

  1. How to stop the service sh shutdown. Sh or ps – ef | grep tomcat find process Then a kill 9 process

  2. Backup old code cp webapps/ Jenkins/backup /

  3. Upload the new package Rz and press Enter

  4. Check whether the port is being used netstat nult | grep, 8080 (1). 2. If yes, go to the conf directory to change the port number.)

  5. Start services and monitor startup logs sh startup.sh & tail -f… /logs/catalina.out

  6. What operating system is the test environment, and who maintains the test environment? The test environment is Linux operating system. The centos6.5 test environment used by our company at that time is generally development and maintenance

  7. Who released the test environment and how did it get released (and how did it get deployed)?

In our company are generally test to release Development contract first, we use xshell (CRT) connect to the server, first stop service, backup on a version of the test package, to replace the current test package, then ready to start the service, we need before starting of tomcat port is being used, put the directory of packages whether it is right, etc., Check whether tomcat is correct, and check whether the startup log is normal. Finally, open the web page and enter the address. If the web page runs properly, the application is successfully deployed.

  1. What is the JDK version in your company? What is the Tomcat version?
The JDK uses JDK 1.7 and tomcat uses 7Copy the code
  1. How to change the default tomcat port number?
Go to the conf directory of tomcat and run the vi command to enter the server. XML file. Press a to edit the file, change the port number, and save the configuration and exit (: wq).Copy the code
  1. Where is the log in Tomcat? What is the log name?
Tail -f catalina.out is used to view logs in the catalina.out file in the logs directory of TomcatCopy the code
  1. Where is the Tomcat startup file?
Sh in the bin directory. 15. How do I check whether the Tomcat port number is occupied? If netstat nult | grep 8080 display content of the occupiedCopy the code
  1. How do I view the Tomcat process?
ps -ef |grep tomcat
Copy the code
  1. Can you simply draw the server frame?
! [insert picture description here] (HTTP: / / https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2ca5750fe2ce45b0b774eeb5d820a5ee~tplv-k3u1fbpfcp-zoom-1.im age)Copy the code

Common middleware 1. Tomcat can be used for local development or small projects or personal development 2. Linux can also use Jetty, Apache 3. 4. Tomcat is developed in Java and is a JSP/Serverlet container. The open source Weblogic server of the project is an enterprise application server. Oracle develops websphere as an application server developed by IBM. What is Nginx? Nginx is an open source and high performance, reliable HTTP middleware features: less memory consumption, strong concurrency processing can do Web services, reverse proxy can withstand 3W-5W concurrency, processing response is fast, suitable for static requests

Software testing professional books

Blog Source: Blog of rainy Night