码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat启动失败的常见原因

时间:2020-07-15 13:06:14      阅读:78      评论:0      收藏:0      [点我收藏+]

标签:窗口   prot   完全   ssi   star   body   ice   get   boot   

 

 

根据不同情况,笔者碰到过的有以下几种情况:

1. 运行tomcat的启动文件startup.bat,弹出黑窗口,直接闪退。

    这种情况一般都是没有配置JAVA_HOME导致的,配置jdk如果没有使用JAVA_HOME的方式配置环境变量,就会出这种问题

2. 启动后,停留一段时间,打印一些日志,然后窗口关闭。

  这种情况一般是端口号冲突了。

  由于端口号只会支持一个程序运行,如果tomcat的默认端口号被其他程序占用,就会导致冲突。解决这种问题的手段分为两种,第一,关闭占用默认端口号的程序(不太建议),第二,修改tomcat使用的默认端口号。

  关闭占用默认端口号的程序

       如果选择结束掉占用了默认端口号的程序,如何查看是哪个程序占用了端口号呢?

  在cmd命令输入netstat -aov

技术图片

本地地址最右侧就是已经被使用的端口号,找到默认端口号8080,记下最右侧的数字(PID的值)

接着打开任务管理器,找到和PID值匹配的进程,将其关闭即可(默认情况下,任务管理器不会显示PID,需要手动开启PID显示)

技术图片

技术图片

修改tomcat使用的默认端口号

在TomCat文件目录下找到conf文件下的server.xml文件

技术图片

修改上图的8080即可。

3. 运行tomcat后,tomcat很快就启动完成了,但是日志打印了一大堆严重。

    这种情况,似乎是因为tomcat的权限不足导致的,需要提升tomcat的权限,只需要修改tomcat中的config文件夹的权限,将权限改成完全控制,如下图(要注意,一定要修改电脑当前登录用户下的权限,否则没用,在下图中的组或用户名中找到当前登录的用户。)

技术图片

发一下,这种情况报的错误信息。

信息: Loaded APR based Apache Tomcat Native library 1.1.14.
2009-5-25 7:55:48 org.apache.catalina.core.AprLifecycleListener init
信息: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
2009-5-25 7:55:50 org.apache.coyote.http11.Http11AprProtocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2009-5-25 7:55:50 org.apache.coyote.ajp.AjpAprProtocol init
信息: Initializing Coyote AJP/1.3 on ajp-8009
2009-5-25 7:55:50 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3594 ms
2009-5-25 7:55:50 org.apache.naming.NamingContext lookup
警告: Unexpected exception resolving reference
java.io.IOException: Cannot rename original file to C:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/tomcat-users.xml.old
 at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:582)
 at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:104)
 at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140)
 at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
 at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)
 at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:137)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:109)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:703)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-5-25 7:55:50 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
严重: Exception processing Global JNDI Resources
javax.naming.NamingException: Cannot rename original file to C:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/tomcat-users.xml.old
 at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
 at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)
 at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:137)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:109)
 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:703)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-5-25 7:55:50 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2009-5-25 7:55:50 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.18
2009-5-25 7:55:50 org.apache.naming.NamingContext lookup
警告: Unexpected exception resolving reference
java.io.IOException: Cannot rename original file to C:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/tomcat-users.xml.old
 at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:582)
 at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:104)
 at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140)
 at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
 at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:253)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1037)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-5-25 7:55:50 org.apache.catalina.realm.UserDatabaseRealm start
严重: Exception looking up UserDatabase under key UserDatabase
javax.naming.NamingException: Cannot rename original file to C:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/tomcat-users.xml.old
 at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
 at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:253)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1037)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-5-25 7:55:50 org.apache.catalina.startup.Catalina start
严重: Catalina.start: 
LifecycleException:  No UserDatabase component found under key UserDatabase
 at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:261)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1037)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-5-25 7:55:50 org.apache.catalina.startup.Catalina start
信息: Server startup in 299 ms

tomcat启动失败的常见原因

标签:窗口   prot   完全   ssi   star   body   ice   get   boot   

原文地址:https://www.cnblogs.com/liumin-txgt/p/13304451.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!