In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how Tomcat deploys services. Xiaobian thinks it is quite practical, so share it with you for reference. I hope you can gain something after reading this article.
Tomcat Overview Free, open-source Web application server Apache Software Foundation (Apache Software Foundation)Jakarta project in a core project by Apache, Sun and a number of companies and individuals jointly developed by Java enthusiasts love, and get some software developers approval of the more popular Web application server Tomcat core components
Tomcat processing requests
1. The user enters the URL localhost:8080/test/index.jsp in the browser, and the request is sent to the native port 8080, which is obtained by the Coyote HTTP/1.1 Connector listening there;
2. Connector hands over the request to the Engine (Container) of the Service where it is located to process, and waits for the Engine's response;
Engine gets the request localhost/test/index.jsp, matching all virtual hosts Host;
Engine matches a Host named localhost (even if it doesn't match, the request is passed to this Host because this Host is defined as the default host for this Engine), Host named localhost gets the request/test/index.jsp, matching all the contexts it owns. Host matches to Context with path/test (if not, pass the request to Context with path name " " for processing);
5.Path="/test" Context gets the request/index.jsp and finds the corresponding Servlet in its mapping table. Context matches Servlet with URL Pattern *.jsp, corresponding to JspServlet class;
6. Construct HttpServletRequest object and HttpServletResponse object, call doGet() or doPost() of JspServlet as parameters, execute business logic, data storage, etc.;
7. Context returns the HttpServletResponse object to the Host after execution;
8.Host returns HttpServletResponse object to Engine;
9.Engine returns the HttpServletResponse object to Connector;
Connector returns the HttpServletResponse object to the client Browser.
Tomcat Directory Details
●bin
Storing script files for starting and shutting down Tomcat, the more commonly used ones are catalina.sh, startup.sh,
shutdown.sh Three files
●conf
Store various configuration files of Tomcat server, the more commonly used are server.xml, context.xml,
tomcat-users.xml and web.xml.
●lib
The jar package that holds the Tomcat server generally does not change unless it is connected to a third-party service, such as redis,
Then you need to add the corresponding jar package
●logs
Storing Tomcat logs
●temp
Holds files generated by Tomcat runtime
●webapps
Directory of project resources
●work
Tomcat working directory, generally used to clear Tomcat cache
Tomcat Deployment Jdk must be installed before Tomcat deployment, because jdk is a necessary environment for Tomcat to run. All the source code package needs, please private letter me. First access the shared directory of the host and mount [root@localhost ~]# smbclient -L //192.168.100.23/Enter SAMBA\root's password: OS=[Windows 10 Enterprise 17763] Server=[Windows 10 Enterprise 6.3] Sharename Type Comment --------- ---- ------- ADMIN$ Disk remote management C$ Disk default share D$ Disk default share E$ Disk default share F$ Disk default share G$ Disk default share IPC$ IPC remote IPC LAMP Disk LAMP-C7 Disk LNMP Disk share Disk tomcat Disk Users Disk Connection to 192.168.100.23 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)NetBIOS over TCP disabled -- no workgroup available[root@localhost ~]# mkdir /chen[root@localhost ~]# mount.cifs //192.168.100.23/tomcat /chen/Password for root@//192.168.100.23/tomcat: [root@localhost ~]# cd /chen/[root@localhost chen]# ls12D18CFCD6599AFF0445766ACC4CA231C5025773.torrent apache-jmeter-5.1.zip jdk-8u201-linux-x64.rpmapache-jmeter-5.1 apache-tomcat-9.0.16.tar.gz tomcat optimization pressure test.jmx install jdk source package, set environment variable [root@localhost chen]# rpm -ivh jdk-8u201-linux-x64.rpm [root@localhost jdk1.8.0_201-amd64]# vim /etc/profileexport JAVA_HOME=/usr/java/jdk1.8.0_201-amd64#declare java working directory JAVA CLASSPATH=$export_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar#declare java class file location PATH=$HOME/bin: $PATH#Declare java environment variables [root@localhost jdk1.8.0_201-amd64]# source /etc/profile Make soft links to facilitate system recognition of Tomcat commands, Start service [root@localhost chen]# tar zxvf apache-tomcat-9.0.16.tar.gz-C /usr/local/[root@localhost chen]# cd /usr/local/[root@localhost local]# lsapache-tomcat-9.0.16 bin etc games include lib lib64 libexec sbin share src[root@localhost local]# mv apache-tomcat-9.0.16/ tomcat[root@localhost local]# lsbin etc games include lib lib64 libexec sbin share src tomcat[root@localhost local]# cd tomcat/bin/[root@localhost bin]#lsbootstrap.jar ciphers.sh daemon.sh setclasspath.bat startup.sh version.batcatalina.bat commons-daemon.jar digest.bat setclasspath.sh tomcat-juli.jar version.shcatalina.sh commons-daemon-native.tar.gz digest.sh shutdown.bat tomcat-native.tar.gzcatalina-tasks.xml configtest.bat makebase.bat shutdown.sh tool-wrapper.batciphers.bat configtest.sh makebase.sh startup.bat tool-wrapper.sh[root@localhost bin]# ln -s /usr/local/tomcat/bin/startup.shCreate a soft link to the tomcat startup script in the system directory for easy system identification [root@localhost bin]# ln -s /usr/local/tomcat/bin/shutdown.up.shCreate a soft link to the tomcat shutdown script in the system directory for easy system identification [root@localhost bin]#startup.sh #Start tomcat service Using CATALINA_BASE: /usr/local/tomcatUsing CATALINA_HOME: /usr/local/tomcatUsing CATALINA_TMPDIR: /usr/local/tomcat/tempUsing JRE_HOME: /usr/java/jdk1.8.0_201-amd64Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jarTomcat started. [root@localhost bin]# systemctl stop firewalld.service [root@localhost bin]# setenforce 0[root@localhost bin]# netstat -ntap | grep 8080tcp6 0 0 :::8080 :::* LISTEN 80982/java to test Tomcat web page
Optimize Tomcat startup time [root@localhost bin]# vim /usr/java/jdk1.8.0_201-amd64/jre/lib/security/java.security#Modify java.security parametersecurrandom.source=file:/dev/urrandom #Retrieves random parameter entry, modifies random to urrandom to shorten startup time [root@localhost bin]#startup.sh Using CATALINA_BASE: /usr/local/tomcatUsing CATALINA_HOME: /usr/local/tomcatUsing CATALINA_TMPDIR: /usr/local/tomcat/tempUsing JRE_HOME: /usr/java/jdk1.8.0_201-amd64Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jarTomcat started. About "Tomcat how to deploy services" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.