一、上传Tomcat服务器:我上传的就是解压缩的文件
2、配置环境变量
编辑vi /etc/profile
tomcat服务器运行时是需要JDK支持的,所以必须配置好JDK用到的那些环境变量,jdk配置已经配置过了(可以去我的博客找)。
3修改tomcat启动端口
vi /usr/tomcat/apache-tomcat-7.0.57/conf/server.xml
4:启动tomcat
[root@dbserver bin]# ./startup.sh
-bash: ./startup.sh: Permission denied
[root@dbserver bin]#
解决
原因
在执行tomcat的时候,用户没有权限,而导致无法执行,
用命令chmod 修改一下bin目录下的.sh权限就可以了
chmod u+x *.sh
重新启动
[root@dbserver bin]# ./startup.sh
Using CATALINA_BASE: /usr/tomcat/apache-tomcat-7.0.57
Using CATALINA_HOME: /usr/tomcat/apache-tomcat-7.0.57
Using CATALINA_TMPDIR: /usr/tomcat/apache-tomcat-7.0.57/temp
Using JRE_HOME: /usr/java/jdk1.7.0_79/jre
Using CLASSPATH: /usr/tomcat/apache-tomcat-7.0.57/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-7.0.57/bin/tomcat-juli.jar
Tomcat started.
5查看启动日志
[root@dbserver apache-tomcat-7.0.57]# cd logs
[root@dbserver logs]# cat catalina.out
全部日志
ep 21, 2017 10:37:45 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:sport12' did not f
ind a matching property.Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.57
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Nov 3 2014 08:39:16 UTC
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.57.0
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 3.10.0-327.el7.x86_64
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JAVA_HOME: /usr/java/jdk1.7.0_79/jre
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_79-b15
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /usr/tomcat/apache-tomcat-7.0.57
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /usr/tomcat/apache-tomcat-7.0.57
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.config.file=/usr/tomcat/apache-tomcat-7.0.57/conf/logging.properties
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/usr/tomcat/apache-tomcat-7.0.57/endorsed
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/usr/tomcat/apache-tomcat-7.0.57
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/usr/tomcat/apache-tomcat-7.0.57
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=/usr/tomcat/apache-tomcat-7.0.57/temp
Sep 21, 2017 10:37:45 AM 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.librar
y.path: /usr/oracle/product/lib:/usr/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/libSep 21, 2017 10:37:45 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Sep 21, 2017 10:37:45 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1417 ms
Sep 21, 2017 10:37:45 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 21, 2017 10:37:45 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.57
Sep 21, 2017 10:37:45 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /usr/tomcat/apache-tomcat-7.0.57/webapps/H:\java\apache-tomcat-7.0.57\webapps\sport12 does
not exist or is not a readable directory at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:136)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:5110)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Sep 21, 2017 10:37:45 AM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].Standard
Host[localhost].StandardContext[]] at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContex
t[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Error in resourceStart()
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5295)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Sep 21, 2017 10:37:45 AM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].Standard
Host[localhost]] at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Sep 21, 2017 10:37:45 AM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
错误原因:
H:\java\apache-tomcat-7.0.57\webapps\sport12 does 的项目被我删了引起的,下载一个全新的tomcat按上面安装就没问题。
我把apache-tomcat-7.0.57删掉,重新下载一个apache-tomcat-7.0.81(apache-tomcat-7.0.81.tar.gz)
启动后就成功了
端口改为:8090