In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
When the container starts, the output log information of tomcat is as follows
Docker logs 5ddb9eeb4815
Using CATALINA_BASE: / opt/tomcat-8.5.11
Using CATALINA_HOME: / opt/tomcat-8.5.11
Using CATALINA_TMPDIR: / opt/tomcat-8.5.11/temp
Using JRE_HOME: / opt/jdk1.8.0_73
Using CLASSPATH: / opt/tomcat-8.5.11/bin/bootstrap.jar:/opt/tomcat-8.5.11/bin/tomcat-juli.jar
Tomcat started.
22-Jul-2019 06:12:52.297 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.11
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jan 10 2017 21:02:52 UTC
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.11.0
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
22-Jul-2019 06 org.apache.catalina.startup.VersionLoggerListener.log OS Version 12 main 52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-514.el7.x86_64
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: / opt/jdk1.8.0_73/jre
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_73-b02
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: / opt/tomcat-8.5.11
22-Jul-2019 06:12:52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: / opt/tomcat-8.5.11
22-Jul-2019 06 org.apache.catalina.startup.VersionLoggerListener.log Command line argument 12 main 52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Djava.util.logging.config.file=/opt/tomcat-8.5.11/conf/logging.properties
22-Jul-2019 06 org.apache.catalina.startup.VersionLoggerListener.log Command line argument 12 main 52.299 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
22-Jul-2019 06 main 12 main 52.300 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Djdk.tls.ephemeralDHKeySize=2048
22-Jul-2019 06 main 12 main 52.300 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Djava.protocol.handler.pkgs=org.apache.catalina.webresources
22-Jul-2019 06 main 12 main 52.300 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Dcatalina.base=/opt/tomcat-8.5.11
22-Jul-2019 06 main 12 main 52.300 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Dcatalina.home=/opt/tomcat-8.5.11
22-Jul-2019 06 main 12 main 52.300 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Djava.io.tmpdir=/opt/tomcat-8.5.11/temp
22-Jul-2019 06:12:52.300 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: / usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
22-Jul-2019 06 main 12 main 52.566 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
22-Jul-2019 06:12:52.593 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-Jul-2019 06 main 12 org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler 52.606 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
22-Jul-2019 06:12:52.607 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-Jul-2019 06:12:52.611 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1015 ms
22-Jul-2019 06:12:52.663 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
22-Jul-2019 06:12:52.664 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.11
22-Jul-2019 06:12:52.682 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory / opt/tomcat-8.5.11/webapps/ROOT
22-Jul-2019 06:13:09.698 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [16530] milliseconds.
22-Jul-2019 06:13:09.795 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory / opt/tomcat-8.5.11/webapps/ROOT has finished in 17113 ms
22-Jul-2019 06:13:09.795 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory / opt/tomcat-8.5.11/webapps/docs
22-Jul-2019 06:13:09.891 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory / opt/tomcat-8.5.11/webapps/docs has finished in 96 ms
22-Jul-2019 06:13:09.891 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory / opt/tomcat-8.5.11/webapps/examples
22-Jul-2019 06:13:10.384 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory / opt/tomcat-8.5.11/webapps/examples has finished in 493 ms
22-Jul-2019 06:13:10.385 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory / opt/tomcat-8.5.11/webapps/host-manager
22-Jul-2019 06:13:10.429 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory / opt/tomcat-8.5.11/webapps/host-manager has finished in 43 ms
22-Jul-2019 06:13:10.429 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory / opt/tomcat-8.5.11/webapps/manager
22-Jul-2019 06:13:10.470 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory / opt/tomcat-8.5.11/webapps/manager has finished in 41 ms
22-Jul-2019 06:13:10.487 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [http-nio-8080]
22-Jul-2019 06:13:10.494 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [ajp-nio-8009]
22-Jul-2019 06:13:10.495 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 17883 ms
22-Jul-2019 06:15:15.904 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
22-Jul-2019 06 main 15 org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler 15.905 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
22-Jul-2019 06 ajp-nio-8009 1515 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
22-Jul-2019 06:15:16.008 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
22-Jul-2019 06 main 1515 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
22-Jul-2019 06 main 1515 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
22-Jul-2019 06 main 1515 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
22-Jul-2019 06 org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler 1516. 060 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
Go inside the container to check its time
Local CST time zone, indicating that Docker and the operating system use the same time zone
Description:
(1) UTC
The whole earth is divided into 24 time zones, each with its own local time. In the international radio communication situation, for the sake of unity, a unified time is used, which is called UTC, Universal Time Coordinated.
(2) GMT
Greenwich mean time (Greenwich Mean Time) is the standard time of the Greenwich Observatory on the outskirts of London, England, because the prime meridian is defined as the longitude through which it passes. (the UTC and GMT times are basically the same, and no distinction is made in this article)
(3) CST
China Standard time (China Standard Time)
The code is as follows:
GMT + 8 = UTC + 8 = CST
(4) DST
Daylight saving time (Daylight Saving Time) means that when the sun rises earlier in summer, the clock is set forward one hour to advance the use of daylight. (not used in China)
Because Tomcat startup uses the default time zone of JVM startup, isn't JVM startup using the default time zone provided by the system? Answer: no, the default is UTC time zone.
Based on this phenomenon, I wrote the test code in the container:
Public class Test {public static void main (String [] args) {System.out.println (new java.util.Date ()); System.out.println (System.getProperty ("user.timezone"));}}
Compile and then run
Javac-g Test.java# java Test
Take a look at the screenshot below:
It's exactly eight hours apart.
Finding the reason is actually easy to solve.
One is to modify the default time zone provided by JVM startup, and the other is to modify the Tomcat startup script.
I choose to modify the parameters of the Tomcat startup script here.
Add the following to $Tomcat_HOME/bin/catalina.sh:
Export JAVA_OPTS= "$JAVA_OPTS-server-Dfile.encoding=UTF-8-Duser.timezone=GMT+08"
Finally, start Tomcat, which is normal, as shown below:
Method 2:
Use tzselect to make modifications
# tzselect
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none-I want to specify the time zone using the Posix TZ format.
Select 5
Please select a country.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
Option 9
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time
Select 1
The following information has been given:
China
Beijing Time
Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Mon Jul 22 15:55:01 CST 2019.
Universal Time is now: Mon Jul 22 07:55:01 UTC 2019.
Is the above information OK?
1) Yes
2) No
Select 1
# cp / etc/timezone / etc/timezone.bak
Cat > / etc/timezone
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.