For the first time
/usr/local
stay Official website Download the latest version
http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.31/bin/apache-tomcat-9.0.31.tar.gz
[root@*** local]# pwd /usr/local [root@*** local]# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.30/bin/apache-tomcat-9.0.30.tar.gz --2020-02-20 17:24:44-- http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.30/bin/apache-tomcat-9.0.30.tar.gz Resolving mirror.bit.edu.cn... 202.204.80.77, 219.143.204.117, 2001:da8:204:1205::22 Connecting to mirror.bit.edu.cn|202.204.80.77|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2020-02-20 17:24:46 ERROR 404: Not Found. [root@*** local]# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.31/bin/apache-tomcat-9.0.31.tar.gz --2020-02-20 17:27:28-- http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.31/bin/apache-tomcat-9.0.31.tar.gz Resolving mirror.bit.edu.cn... 202.204.80.77, 219.143.204.117, 2001:da8:204:1205::22 Connecting to mirror.bit.edu.cn|202.204.80.77|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 11042076 (11M) [application/octet-stream] Saving to: "apache-tomcat-9.0.31.tar.gz" 100%[==================================================>] 11,042,076 1.57M/s in 6.6s 2020-02-20 17:27:34 (1.60 MB/s) - "apache-tomcat-9.0.31.tar.gz" saved [11042076/11042076] [root@*** local]# ls aegis bin include libexec nginx redis src apache-tomcat-9.0.31.tar.gz etc lib memcached openssl sbin tomcat apr games lib64 mysql pureftpd share [root@*** local]# tar -zxf apache-tomcat-9.0.31.tar.gz [root@*** local]# ls aegis apr games lib64 mysql pureftpd share apache-tomcat-9.0.31 bin include libexec nginx redis src apache-tomcat-9.0.31.tar.gz etc lib memcached openssl sbin tomcat [root@*** local]#
[root@*** local]# cd apache-tomcat-9.0.31
Published under webapps. (2020-2-20 17:31:41)
[root@*** apache-tomcat-9.0.31]# cd bin [root@*** bin]# ls bootstrap.jar commons-daemon-native.tar.gz makebase.sh tomcat-juli.jar catalina.bat configtest.bat setclasspath.bat tomcat-native.tar.gz catalina.sh configtest.sh setclasspath.sh tool-wrapper.bat catalina-tasks.xml daemon.sh shutdown.bat tool-wrapper.sh ciphers.bat digest.bat shutdown.sh version.bat ciphers.sh digest.sh startup.bat version.sh commons-daemon.jar makebase.bat startup.sh [root@*** bin]# sh startup.sh Using CATALINA_BASE: /usr/local/apache-tomcat-9.0.31 Using CATALINA_HOME: /usr/local/apache-tomcat-9.0.31 Using CATALINA_TMPDIR: /usr/local/apache-tomcat-9.0.31/temp Using JRE_HOME: /usr/java/default Using CLASSPATH: /usr/local/apache-tomcat-9.0.31/bin/bootstrap.jar:/usr/local/apache-tomcat-9.0.31/bin/tomcat-juli.jar Tomcat started. [root@*** bin]#
Start up. (2020-2-20 17:34:47)
Port 8080 is still invalid. You need to use port 9090. Change the port number. (2020-2-20 17:36:18)
Change old tomcat? To the way before 9090?
(2020-2-20 17:37:07)
New use 8080
Modify Baidu
So, how to change the port number of tomcat? First, go to the installation directory (or unzip directory) to find the conf folder, where you can find the server.xml file
How to cancel vim (2020-2-20 17:43:09)
In general mode, pressing the U key once can undo the last input.
vim lookup.
/string
But how to find the next one
n is looking back
N find the word forward
(2020-2-20 17:45:39)
The only 8080 found was changed to 9090. (2020-2-20 17:46:06)
/Under usr/local:
[root@*** local]# ls aegis apr games lib64 mysql pureftpd share apache-tomcat-9.0.31 bin include libexec nginx redis src apache-tomcat-9.0.31.tar.gz etc lib memcached openssl sbin tomcat [root@*** local]# cd tomcat/ [root@*** tomcat]# ls bin conf lib logs README.md RUNNING.txt webapps BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work [root@*** tomcat]# cd conf/ [root@*** conf]# vim server.xml
The process is as above. (2020-2-20 17:48:20)
No effect. Restart. (2020-2-20 17:52:15)
[root@*** local]# service restart tomcat restart: unrecognized service [root@*** local]# service tomcat restart Stoping Tomcat Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/default Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar waiting for processes to exit Starting tomcat Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/default Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started. Tomcat is running with pid: 6522 [root@*** local]#
History command view history command. (2020-2-20 17:55:32)
[root@*** bin]# sh shutdown.sh Using CATALINA_BASE: /usr/local/apache-tomcat-9.0.31 Using CATALINA_HOME: /usr/local/apache-tomcat-9.0.31 Using CATALINA_TMPDIR: /usr/local/apache-tomcat-9.0.31/temp Using JRE_HOME: /usr/java/default Using CLASSPATH: /usr/local/apache-tomcat-9.0.31/bin/bootstrap.jar:/usr/local/apache-tomcat-9.0.31/bin/tomcat-juli.jar Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) [root@*** bin]# pwd /usr/local/apache-tomcat-9.0.31/bin [root@*** bin]#
The above bugs are handled. (2020-2-20 17:56:55)
Baidu
This problem is really caused by an attempt by a java class file compiled by a higher version of JDK to run on a lower version of JVM.
Switch Java version.jdk(2020-2-20 17:58:48)
Have one experience. Know multi version environment
Previous notes
Modify database password. (2020-2-20 18:00:42)
Completed. (2020-2-20 18:02:35)
From here. See the tutorial
Course
JDK version switch
You have successfully changed to 1.8
Run again
# sh shutdown.sh Using CATALINA_BASE: /usr/local/apache-tomcat-9.0.31 Using CATALINA_HOME: /usr/local/apache-tomcat-9.0.31 Using CATALINA_TMPDIR: /usr/local/apache-tomcat-9.0.31/temp Using JRE_HOME: /usr/java/default Using CLASSPATH: /usr/local/apache-tomcat-9.0.31/bin/bootstrap.jar:/usr/local/apache-tomcat-9.0.31/bin/tomcat-juli.jar Feb 20, 2020 6:06:24 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Could not contact [localhost:8005] (base port [8005] and offset [0]). Tomcat may not be running. Feb 20, 2020 6:06:24 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Error stopping Catalina java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:389) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:479)
SEVERE: Could not contact [localhost:8005] (base port [8005] and offset [0]). Tomcat may not be running.
It seems that. tomcat is not started. Then start. (2020-2-20 18:09:09)
/usr/local/apache-tomcat-9.0.31/bin starts
# sh startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-9.0.31
Using CATALINA_HOME: /usr/local/apache-tomcat-9.0.31
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-9.0.31/temp
Using JRE_HOME: /usr/java/default
Using CLASSPATH: /usr/local/apache-tomcat-9.0.31/bin/bootstrap.jar:/usr/local/apache-tomcat-9.0.31/bin/tomcat-juli.jar
Tomcat started.
Success. Start. You can put something in it. (2020-2-20 18:11:36)