Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Java container Tomcat and other intermediate price principle, installation, configuration and use method

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "Java container Tomcat and other intermediate price principle, installation, configuration and use", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Java container Tomcat and other intermediate price principle, installation, configuration and use" it!

Operating system, middleware, database, and called the three major highlands in the field of software systems. Middleware is the software between the operating system and the application, and some people think that it should be part of the operating system. The role of middleware is mainly to abstract common parts for complex applications in order to reduce the complexity of application development.

Therefore, with the update of customer demand and the change of technical conditions, middleware has been continuously developed. The development of middleware has experienced the stages of TM monitor, transaction middleware, message middleware, ORB middleware, application server and so on. At present, the demand of users has gradually risen from the pure pursuit of unilateral functions such as transaction, transaction and interest cancellation to the need for an integrated platform, while technically, it has developed from C, and CORBA-based technology to J2EE. Nowadays, J2EE application server is the mainstream middleware in the market. From the perspective of the whole software industry, middleware builds a bridge between application and technology, and becomes an indispensable link in the software industry chain. From the market point of view, the annual growth of the middleware market exceeds that of the software industry as a whole.

The domestic middleware market is mainly monopolized by two foreign manufacturers, IBM and BEA. They provide middleware products with J2EE application server as the core, which are widely used in banking, securities, telecommunications, and even government industries. E-commerce advocate, IT industry giant IBM launched the application server WebSphere in 1999, relying on the overall influence of IBM for sales, has a deep foundation in the financial and other industries. BEA is a company specializing in middleware development. Its application server product Weblogic is released early and has been widely used in foreign e-commerce. The company is mainly oriented to the industry and high-end market, and currently occupies a major position in the domestic telecommunications and securities industry. Sun is originally a hardware manufacturer of Unix workstations, but as its advocated JAVA technology plays a more and more important role in Internet applications, and J2EE has become an industry standard, Sun has become one of the leaders of Internet technology. Sun has acquired three application server manufacturers in the past two years, which is the biggest affirmation of this technology.

In the global market, large application server providers such as IBM, BEA, Sun, Iona, Oracle, Sybase and so on are fighting secretly. However, it is a pity that in these raging new technology storms, we have always been difficult to find the figure of domestic middleware manufacturers. In the choice of application servers, domestic enterprises not only have to bear the huge costs of foreign manufacturers, but also face the problem of insufficient local support, but also related to national information security and other deep-seated considerations. Domestic software manufacturers and domestic enterprises are in an awkward position.

Let's give a detailed description of the mainstream Java container Tomca:

(1) introduction to Tomcat

Tomcat server is a free and open source Web application server. Tomcat is a core project in the Jakarta project of the Apache Software Foundation (Apache Software Foundation). It was originally called catalina, and later developed by Apache, Sun and other companies and individuals, and renamed Tomcat. Tomcat is a small and lightweight application server, which is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs. Because of its advanced technology and stable performance, Tomcat has become a popular Web application server. Tomcat is an application (java) server, it is just a servlet container, it is an extension of Apache, but it runs independently. The latest version is Tomcat 8.0.24 Released.

Tomcat is not a complete Jave EE server, it does not even provide an implementation of even a major Java EE API; but because it complies with the apache open source protocol, tomcat builds commercial java application servers such as JBoss and JOnAS for many java application servers embedded in their own products. Although Tomcat's implementation of Jave EE API is incomplete, many enterprises are gradually abandoning traditional Java EE technologies (such as EJB) and using some open source components to build complex applications. These open source components, such as Structs, Spring, and Hibernate, are perfectly supported by Tomcat.

(B) the structure of Tomcat:

Tomcat 6 supports the specifications of Servlet 2.5 and JSP 2.1, which consists of a set of nested layers and components, generally divided into the following four categories:

-Top-level components: located at the top of the configuration level and have strict correspondence with each other;-Connectors: connect clients (which can be browsers or Web servers) to Servlet containers,-containers: contain a set of other components;-nested components: in one container, but cannot contain other components

Common components: 1. Server (server): an instance of Tomcat. Usually, a JVM can only contain one Tomcat instance; therefore, one Tomcat instance can be launched in each JVM while multiple JVM is started on a physical server, and each instance belongs to an independent management port. This is a top-level component. 2. Service: a service component usually contains an engine and one or more connectors associated with this engine. Naming services makes it easy for administrators to identify logs generated by different services in log files. A server can contain multiple service components, but usually only one server is assigned to a service.

Connector class components: 3. Connector (connectors): responsible for connecting client (browser or Web server) requests to Web applications in the Servlet container, which usually refers to the location of receiving requests from the client and the port assigned by the server. The default port is usually 8080 of the HTTP protocol, and administrators can also change this port according to their own needs. An engine can be configured with multiple connectors, but these connectors must use different ports. The default connector is HTTP/1.1-based Coyote. Tomcat also supports AJP, JServ, and JK2 connectors.

Container class components: 4, Engine: engine pass refers to the Servlet engine component that processes the request, that is, the Catalina Servlet engine, which checks the HTTP header information of each request to identify which host or context the request should be sent to, and returns the result of the request to the corresponding client. Strictly speaking, a container does not have to be implemented through an engine, it can also be just a container. If Tomcat is configured as a stand-alone server, the default engine is the one that has been defined. If Tomcat is configured as the backend of the Apache Web server that provides Servlet functionality, the default engine will be ignored because the Web server itself can determine where to send user requests. An engine can contain multiple host components. 5. Host: host components are similar to virtual hosts in Apache, but only "virtual hosts" based on FQDN are supported in Tomcat. An engine must contain at least one host component. 6. Context: the Context component is the innermost component, which represents the Web application itself. The most important thing to configure a Context is to specify the root directory of the Web application so that the Servlet container can send user requests to the correct location. The Context component can also contain custom error pages to provide a friendly prompt when an error occurs in user access.

Nested components: these components are usually contained in container class components to provide administrative services. They cannot contain other components, but some can be configured by different levels of containers. 7. Valve (Valve): used to intercept a request and perform some processing before transferring it to the target, similar to the filter defined in the Servlet specification. Valve can be defined in the components of any container class. Valve is often used to record client requests, client IP addresses, and servers, and this processing technique is often referred to as request dump (request dumping). The request dump valve records the HTTP header information and the cookie information file in the request client request data packet, and the response dump valve records the response packet header information and cookie information to the file. 8. Log logger (Logger): used to record the status information within the component, and can be used in any container except Context. Logging can be inherited, so an engine-level Logger will record information about all components within the engine unless an internal component defines its own Logger component. 9. Realm: authentication and authorization for users; when configuring an application, administrators can define roles and permissions for each resource or resource group, and these access control functions need to be implemented through Realm. The authentication of Realm can be based on text files, database tables, LDAP services and so on. The utility of Realm will spread across the entire engine or top-level container, so all applications within a container will share user resources. At the same time, the Realm can be inherited by the subcomponents of its component or overridden by the Realm defined in the subcomponents.

Engine (Engine): an engine is the Servlet engine component that processes requests, the Catalina Servlet engine, which receives requests from HTTPconnector and responds to them. It checks the HTTP header information of each request to identify which host or context the request should be sent to, and returns the result of the request to the corresponding client. Strictly speaking, a container does not have to be implemented through an engine, it can also be just a container. If Tomcat is configured as a stand-alone server, the default engine is the one that has been defined. If Tomcat is configured as the backend of the Apache Web server that provides Servlet functionality, the default engine will be ignored because the Web server itself can determine where to send user requests. An engine can contain multiple host components.

Tomcat Connector Architecture:

Based on the architecture of Apache as the front end of Tomcat, Apache exchanges data with the back-end Tomcat through mod_jk, mod_jk2 or mod_proxy modules. For Tomcat, each Web container instance has a connector module component developed in the Java language, which in Tomcat6 is the org.apache.catalina.Connector class. The constructor of this class can construct two types of connectors: HTTP/1.1 is responsible for responding to requests based on the HTTP/HTTPS protocol and AJP/1.3 is responsible for responding to requests based on AJP. However, you can simply create the connector in the server.xml configuration file, but the classes used to create it vary depending on whether the system supports APR (Apache Portable Runtime).

APR is a collection of native libraries attached to a communication layer on top of an operating system that provides general-purpose and standard API, which provides balanced utility for applications that use APR to provide better scalability when communicating with Apache. At the same time, it should be noted that the mod_jk2 module is no longer supported, and the mod_jk module is currently supported by apache, but its project activity has been greatly reduced. Therefore, at present, the more common way is to use the mod_proxy module.

If APR is supported: if APR is not supported:

Connector protocol: Tomcat's Web server connector supports two protocols: AJP and HTTP, both of which define data transfer between Web server and Tomcat in binary format and provide corresponding control commands.

AJP (Apache JServ Protocol) protocol: the version of the AJP protocol currently in use is AJP13, which is supported through JK and JK2 connectors, which transfers data between Web servers and Tomcat based on binary format, while previous versions of AJP10 and AJP11 use text format to transfer data.

HTTP protocol: as its name suggests, it uses HTTP or HTTPS protocol to establish communication between the Web server and the Tomcat. In this case, Tomcat is a fully functional HTTP server that needs to listen on a port to receive requests from the pre-merchant server.

[installation, configuration and use of Tomcat] (https://mp.weixin.qq.com/s/sZ4dBa3E22qMC3JgCVMMeQ)

(1) JDK-JDK is a software development kit of Java language, which is mainly used for java applications on mobile devices and embedded devices. JDK is the core of the whole java development. It includes the running environment of JAVA-(JVM+Java system class library) and JAVA tools. Without JDK, Java programs (java source code .java files) cannot be compiled.

Using tomcat, first install JDK and configure the java environment.

1. JDK version 1 OpenJDK: the open source version closes the firewall and selinux, and synchronizes the time

[root@tomcat-77 ~] # yum-y install ntdate [root @ tomcat-77 ~] # ntpdate time2.aliyun.com install jdk, select java-1.8.0-openjdk here Yum can be installed locally [root@tomcat-77 ~] # yum-y install java-1.8.0-openjdk [r [root @ tomcat-77 ~] # java- version # version query openjdk version "1.8.0x181" OpenJDK Runtime Environment (build 1.8.0_181-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) # mixed mode Note: after installation, configure the JAVA_HOME environment variable and point to the installation path of java Set the java environment variable [root@tomcat-77 ~] # echo $JAVA_HOME # to query whether there is a path [root@tomcat-77 ~] # vim / etc/profile.d/java.sh # script export JAVA_HOME=/ usr [root @ tomcat-77 ~] #. / etc/profile.d/ java.sh [root @ tomcat-77 ~] # echo $JAVA_HOME/usr

2. JDK version 2 Oracle JDK:oracle official version-download from the official oracle website and install the corresponding version of the rpm package

Jdk-VERSION-OS-ARCH.rpm for example: jdk-1.8.0_25-linux-x64.rpm

3. After the java environment variable configuration and installation is completed, configure the JAVA_HOME environment variable to point to the installation path of java; OpenJDK version:

JAVA_HOME=/usr

Oracle JDK version:

JAVA_HOME=/usr/java/jdk_VERSION

Second, Servlet container: the main task of servlet container is to manage the life cycle of servlet. The web container is more accurately called the web server, which is used to manage and deploy web applications. The most typical web container is tomcat. Tomcat is both a web container and a servlet container.

Servlet (Server Applet) is the abbreviation of Java Servlet, which is called mini-service program or service connector. The main function of server-side program written in Java is to browse and modify data interactively to generate dynamic Web content. In a narrow sense, Servlet refers to an interface implemented by Java language, and in a broad sense, Servlet refers to any class that implements this Servlet interface. Generally speaking, Servlet is understood as the latter. Servlet runs in an application server that supports Java. In principle, Servlet can respond to any type of request, but in most cases Servlet is only used to extend Web servers based on the HTTP protocol. JavaSoft's Java Web Server was the first to support the Servlet standard, and since then, some other Java-based Web servers have begun to support standard Servlet. 3. The application of java in web JSP technology 1. JSP technology defines JSP as a technology. JSP technology inserts Java program segments (Scriptlet) and JSP tags (tag) into traditional web page HTML files (.htm, .html) to form JSP files (* .jsp). So that Web applications developed by JSP can run across platforms. JSP belongs to Servlet, because when compiling JSP, JSP is compiled into a Servlet, and then the service is provided by the container

2. JSP page running process .jsp file-- > jasper-- > .java-- > javac-- > .class class-- > jvm virtual machine example:

TITLE...

Note: the static output data is converted into java code for output based on jasper, and the result is the code of servlet specification.

3. JSP Container: jsp container JSP technology plus Servlet container forms the jsp container, which is later JWS is an implementation of WebService services in Java language, which is used to develop and publish services.

Commercial implementation software are: WebSphere, WebLogic, Oc4j, Glassfish, Geronimo, JOnAS, JBoss,... Open source implementation software are: Tomcat, Jetty, Resin,... 4. Tomcat installation Tomcat server is a free and open source Web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs. For a beginner, it can be thought that when an Apache server is configured on a machine, it can be used to respond to requests for access to an application page under the HTML standard general markup language. Tomcat is actually an extension of the Apache server, but at run time it runs independently, so when you run tomcat, it actually runs as a separate process from Apache. Official website: incomplete implementation of http://tomcat.apache.org/ Java 2 EE technical system

1. Install Tomcat: method 1: Base Repo installation of Tomcat:

[root@tomcat-77 ~] # yum install-y tomcat tomcat-lib tomcat-admin-webapps tomcat-webapps tomcat-docs-webapp [root@tomcat-77 ~] # systemctl start tomcat.service

Tomcat # core package tomcat-lib # library file tomcat-admin-webapp s# based on web page management interface tomcat-webapps # jsp sample program tomcat-docs-webapp # operation document page

Method 2: unpack and install Tomcat

~] # tar xf apache-tomcat-VERSION.tar.gz-C / usr/local/ # extract to the specified directory ~] # cd / usr/locallocal ~] # ln-sv apache-tomcat-VERSION tomcat # set alias local ~] # vim / etc/profile.d/tomcat.sh # Edit environment variable shellexport CATALINA_BASE=/usr/local/tomcatexport PATH=$CATALINA_BASE/bin:$PATHlocal ~] #. / etc/profile.d/tomcat.sh # execute local ~] # cd tomcat/binbin ~] # catalina.sh-- help # help Information bin ~] # catalina.sh version # version Information bin ~] # catalina.sh start # start tomcatbin ~] # catalina.sh stop # stop tomcatbin ~] # catalina.sh stop 9 # 9 seconds stop tomcatbin ~] # catalina.sh stop 9-force#9 seconds and force tomcat to stop

2. Tomcat program environment: tomcat directory structure bin: scripts, and classes used at startup; conf: configuration file directory; lib: library file, Java class library, jar; logs: log file directory; temp: temporary file directory; webapps:webapp default directory; work: working directory

3. Configuration file composition of tomcat: server.xml: main configuration file

Web.xml: each webapp can only be accessed after "deployment". Its deployment method is usually defined by web.xml and its storage location is in the WEB-INF/ directory; this file provides default deployment-related configuration for all webapps; context.xml: each webapp can have a dedicated configuration file, which is usually defined by a dedicated configuration file context.xml, and its storage location is in the WEB-INF/ directory. This file provides default configuration for all > webapps; tomcat-users.xml: account and password file for user authentication; catalina.policy: set security policy for tomcat when tomcat is started with-security option; definition file for catalina.properties:Java property, used to set classloader path and some parameters related to JVM tuning; logging.properties: configuration related to logging system

4. The core component of Tomcat: server.xml

. # engine # mainframe # program.

Each component is implemented by a Java "class", which can be broadly divided into the following types:

Top-level components: Server service class components: Service connector components: http, https, ajp (apache jserv protocol) container classes: Engine, Host, Context are nested classes: valve, logger, realm, loader, manager,... Cluster class components: listener, cluster,...

5. JSP WebAPP deployment: 1. Organizational structure of JSP WebAPP:

/: the root directory of webapps index.jsp: home page; the private resource path of the current webapp of WEB-INF/:; usually used to store the web.xml and context.xml configuration files of the current webapp; META-INF/: is similar to the WEB-INF/; classes/: class file, the class provided by the current webapp; the lib/: class file, the class provided by the current webapp, is packaged in jar format

2. Webapp archive format: .war: webapp .jar: EJB class package file; .rar: resource adapter class package file; .ear: enterprise webapp

[root@tomcat-77 ~] # ls / var/lib/tomcatwebapps

3. Operations related to deployment (deploy) webapp: step: deploy: place the source files of webapp in the target directory (the directory where the web program files are stored), and configure the tomcat server to access the webapp; based on the paths defined in web.xml and context.xml files. There are two ways to load its unique and dependent classes to JVM; through class loader: automatic deployment and manual deployment:

Cold deployment: copy webapp to the specified location before starting tomcat; hot deployment: deploy without stopping tomcat; anti-deployment: undeploy:, stops webapp and uninstalls webapp from the tomcat instance

Deployment tools: manage:r, ant scripts, tcd (tomcat client deployer), etc.

Command: start: start webapp; stop in the stopped state: stop webapp and no longer provide services to users; its class is still on jvm; redeploy: redeploy

4. Manually provide a test application and deploy it cold: example:

[root@tomcat-77 ~] # cd / var/cache/tomcat/ work [root @ tomcat-77 work] # lsCatalina [root @ tomcat-77 work] # tree Catalina/Catalina/ └── localhost ├── _ │ └── org │ apache │ └── jsp │ ├── index_jsp.class │ └── Index_jsp.java ├── docs ├── examples ├── host-manager # manages the virtual host ├── manager │ └── org │ └── apache │ └── jsp │ └── WEB_002dINF │ └── jsp │ ├── _ 401_jsp.class │ └── _ 401_jsp.java └── sample# mkidr-pv / usr/local/tomcat/webapps/test/ {classes Lib,WEB-INF} create file / usr/local/tomcat/webapps/test/index.jspTest Page

6. Two management applications of tomcat: 1. Enable manager

[root@tomcat-77 ~] # vim / etc/tomcat/tomcat-users.xml [root@tomcat-77 ~] # systemctl restart tomcat

2. Host-manager virtual host management

[root@tomcat-77 ~] # vim / etc/tomcat/tomcat-users.xml [root@tomcat-77 ~] # systemctl restart tomcat

Through the gui interface, virtual hosts can be hot deployed.

3. Common component configuration of tomcat: Server: represents tomcat instance, that is, a java process; listens on port 8005 and only receives "SHUTDOWN". Each server listens on different ports, so when launching multiple instances on the same physical host, you need to modify its listening ports to different ports. Service: used to associate one or more connector components with one engine component

4. Connector connector component: responsible for receiving requests. There are three common http/https/ajp; requests into tomcat that can be divided into two categories: (1) standalone: the request comes from the client browser; (2) it is replaced by other web server: the reverse server from the front end Case 1: nginx inversion-- > http connector-- > tomcat case 2: httpd (proxy_http_module) inversion-- > http connector-- > tomcat httpd (proxy_ajp_module) inversion-- > ajp connector-- > tomcat case 3: httpd (mod_jk)-> ajp connector-- > tomcat

5. Connector connector properties:

Port= "8080" # listening port protocol= "HTTP/1.1" # Protocol connectionTimeout= "20000" # timeout address: listening IP address; default is all local available addresses; maxThreads: maximum number of concurrent connections, default is 200; enableLookups: whether to enable DNS query feature, it is recommended to turn off to improve performance; acceptCount: maximum length of waiting queue; secure: security sslProtocol:

6. Engine container components: Servlet instance, that is, servlet engine, in which one or more host components can define sites. Usually, you need to define default virtual hosts through defaultHost. Attributes of Engine container components:

Name= # name defaultHost= "localhost" # default host jvmRoute=: route ID of jvm

7. Host component: the host or virtual host located inside the engine to receive requests and process them accordingly

Example: # automatic deployment

Common attribute description: (1) appBase: the default storage directory of the webapps of this Host, which refers to the directory where non-archived web applications or archived WAR files are stored; the relative path based on the path defined by the $CATALINA_BASE variable can be used; (2) autoDeploy: whether a webapp is automatically deployed to tomcat when Tomcat is running when it is placed in a directory defined by appBase

Example: # automatic deployment # mkdir-pv / appdata/webapps # create storage directory # mkdir-pv / appdata/webapps/ROOT/ {lib,classes,WEB-INF} # create a directory, and the site is deployed under the root path

Just provide a test page.

8. Context components:

Example: # access the url path and then be specified on another path that can be reloaded

9. Valve components:

# here & quot means quotation marks,% r the content of the user's request

There are many types of Valve: define access log: org.apache.catalina.valves.AccessLogValve define access control: org.apache.catalina.valves.RemoteAddrValve tomcat log path: / var/log/tomcat/

Comprehensive example: # access url is test, document path is tmp/test, and can be reloaded # record log format

7. Tomcat reverse configuration 1. LNMT architecture Client (http)-> nginx (reverse proxy) (http)-> tomcat (http connector)

Nginx connector

Nginx inversion setting: vim / etc/nginx/conf.d/ilinux.confserver {listen 80; # listening port server_name www.ilinux.io; # service name location / {proxy_pass http://192.168.1.15:80; # matches static content to port 80} location ~ *\. (jsp | do) ${proxy_pass http://192.168.1.16:8080; # match dynamic jsp content to backend Tomcat hosts}

2. LAMT architecture Linux Apache (httpd) MySQL Tomcat httpd proxy module:

Proxy_module: reverse core module proxy_http_module: adapting to http protocol client; proxy_ajp_module: adapting to ajp protocol client

Client (http)-> httpd (proxy_http_module) (http)-> tomcat (http connector) Client (http)-> httpd (proxy_ajp_module) (ajp)-> tomcat (ajp connector) Client (http)-> httpd (mod_jk) (ajp)-> tomcat (ajp connector)

Http connector: using proxy_http_module module reverse proxy

# proxy_http_module proxy configuration example: # define virtual host ServerName tc1.ilinux.ioProxyRequests Off # turn off forward proxy ProxyVia On # add viaProxyPreserveHost On # request message in the response message to the backend Require all granted # reverse function can be used by those users # if the backend has multiple virtual hosts Cannot use ip address ProxyPass / http://192.168.1.15:8080/ # backend tomcat host address port ProxyPassReverse / http://192.168.1.15:8080/ # return redirect Require all granted # who can access this url

Ajp Connector: using proxy_ajp_module proxy

# proxy_ajp_module proxy configuration sample ServerName tc1.ilinux.ioProxyRequests Off# closes forward proxy ProxyVia On # adding viaProxyPreserveHost OnRequire all granted# reverse substitution function in response message can be used by those users # if there are multiple virtual hosts at the backend Cannot use ip address ProxyPass / ajp:// http://192.168.1.15:8009/ backend tomcat host address port ProxyPassReverse / ajp:// http://192.168.1.15:8009/Require all granted# who can access this url

8. Commonly used optimized configuration of Tomcat: 1. Memory space management: edit / etc/sysconfig/tomcat

# the importance cannot exceed 32G Java XX:NewSize= OPTS = "- server-Xms32g-Xmx32g-XX:NewSize=-XX:MaxNewSize=-XX:PermSize=-XX:MaxPermSize=" # Experimental addition: JAVA_OPTS= "- Xmx512m"-Xms "512m"

Server: server model Xms: heap memory initialization size; Xmx: heap memory space upper limit; XX:NewSize=: Cenozoic space initialization size; XX:MaxNewSize=: Cenozoic space maximum; XX:PermSize=: persistent generation space initialization size; XX:MaxPermSize=: persistent generation space maximum

2. Thread pool settings:

Common attributes:

MaxThreads: maximum number of threads; minSpareThreads: minimum number of idle threads; maxSpareThreads: maximum number of idle threads; acceptCount: maximum length of waiting queue; URIEncoding:URI address encoding format, recommended UTF-8; enableLookups: whether dns parsing is enabled, recommended disabled; compression: whether transport compression mechanism is enabled, recommended "on"; compressionMinSize: minimum data flow enabled for compression transmission in bytes; compressableMimeType: define the MIME type that enables compression Text/html, text/xml, text/css, text/javascript

3) disable port 8005

(4) hide version information:

Server= "SOME STRING" # plus custom string

9. Commonly used analysis tools of JVM:

JVM's analysis tools are: jps: used to view all running jvm processes; jinfo: to view the running environment parameters of the process, mainly jvm command line parameters; jstat: to monitor the resources and performance of jvm applications in real time; jstack: to view the running status of all threads; jmap: to view the status of jvm occupying physical memory; and jconsole: graphical interface, a built-in Java performance analyzer to monitor resource consumption and performance Jvisualvm: graphical interface, plug-in for monitoring the operation of JVM; 1. Jps tools jps:Java virtual machine process status tool, format: jps [- Q] [- mlvV] []-Q: silent mode;-v: display the command line arguments passed to jvm;-m: output the parameters passed into the main method;-l: output the main class or jar fully qualified name -V: displays the parameters passed to jvm through the flag file; []: host id, default is localhost

2. Jinfo tool jinfo: outputs all configuration information of a given java process

Format: jinfo [option]-flags:to print VM flags print flag bit-sysprops:to print Java system properties-flag: to print the value of the named VM flag

3. Jstack tool jstack: view information about the thread stack of the specified java process

Format: jstack [- l] jstack-F [- m] [- l]-l:long listings, which displays additional lock information, so this option is often used when deadlocks occur;-m: mixed mode, which outputs both java stack information and Cmax PID + stack information;-F: when there is no response using "jstack-l PID", you can use-F to force output information.

Thank you for your reading, the above is the "Java container Tomcat and other intermediate price principle, installation, configuration and use method" content, after the study of this article, I believe you on the Java container Tomcat and other intermediate price principle, installation, configuration and use of this problem have a deeper understanding, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report