Linux系统下载安装JDK
tomcat官网(tomcat9下载)
mkdir /usr/local/tomcat
tar -zxvf apache-tomcat-7.0.96.tar.gz -C /usr/local/tomcat
cd /usr/local/tomcat/apache-tomcat-7.0.96
cd conf
vim server.xml
按键盘上的 i 开启编辑
添加:
保存:
:wq + 回车
启动
./startup.sh
查看
ps -ef |grep tomcat
cd /***/apache-tomcat-7.0.96/logs/
查看日志
tail -f catalina.out
curl http://(服务器IP地址):8080
./shutdown.sh
Linux系统管理防火墙
比如我在本地打包时使用的jdk是jdk1.8,服务器上使用的是jdk1.7.0_51,这个时候在项目上传启动tomcat后,会报出以下问题:
Oct 10, 2019 2:16:46 PM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance.
Oct 10, 2019 2:16:46 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-8080"]
Oct 10, 2019 2:16:46 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Oct 10, 2019 2:16:46 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Oct 10, 2019 2:16:46 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-nio-8080"]
Oct 10, 2019 2:16:46 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Oct 10, 2019 2:16:46 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-8080"]
Oct 10, 2019 2:16:46 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Oct 10, 2019 2:21:35 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Executor} Setting property 'maxSpareThreads' to '2000' did not find a matching property.
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.96
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jul 24 2019 13:00:10 UTC
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.96.0
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 3.10.0-862.el7.x86_64
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /u01/jdk/jre
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_51-b13
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /u01/jingdaijieru/apache-tomcat-7.0.96-bk
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /u01/jingdaijieru/apache-tomcat-7.0.96-bk
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.config.file=/u01/jingdaijieru/apache-tomcat-7.0.96-bk/conf/logging.properties
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dignore.endorsed.dirs=
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/u01/jingdaijieru/apache-tomcat-7.0.96-bk
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/u01/jingdaijieru/apache-tomcat-7.0.96-bk
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=/u01/jingdaijieru/apache-tomcat-7.0.96-bk/temp
Oct 10, 2019 2:21:35 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: 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
Oct 10, 2019 2:21:35 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Oct 10, 2019 2:21:35 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Oct 10, 2019 2:21:35 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 655 ms
Oct 10, 2019 2:21:35 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Oct 10, 2019 2:21:35 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.96
Oct 10, 2019 2:21:35 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /u01/jingdaijieru/apache-tomcat-7.0.96-bk/webapps/dscc.war
Oct 10, 2019 2:21:36 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/u01/jingdaijieru/apache-tomcat-7.0.96-bk/webapps/dscc/WEB-INF/lib/servlet-api-2.3.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 10, 2019 2:21:40 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Oct 10, 2019 2:21:40 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/dscc] startup failed due to previous errors
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /u01/jingdaijieru/apache-tomcat-7.0.96-bk/webapps/dscc.war has finished in 4,696 ms
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /u01/jingdaijieru/apache-tomcat-7.0.96-bk/webapps/ROOT
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /u01/jingdaijieru/apache-tomcat-7.0.96-bk/webapps/ROOT has finished in 88 ms
Oct 10, 2019 2:21:40 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Oct 10, 2019 2:21:40 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Oct 10, 2019 2:21:40 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5066 ms