我是 Linux 新手,我已经使用 yum 在 centos 5.6 上安装了 java 和 tomcat6。
我的系统中还安装了 php、mysql 和 apcahe。
apache port 80
mysql port 3306
tomcat port 8080
它们都处于运行状态。现在,当我启动我的 tomcat 服务时,它是否成功启动,但我在 catalina.out 中收到以下错误消息:
[root@centos5 tomcat6]# /sbin/service tomcat6 restart
Stopping tomcat6: [ OK ]
Starting tomcat6: [ OK ]
[root@centos5 tomcat6]# cat /var/log/tomcat6/catalina.out
/sbin/runuser: warning: cannot change directory to /usr/share/tomcat5: No such file or directory
Mar 19, 2013 8:17:21 AM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Mar 19, 2013 8:17:21 AM org.apache.catalina.connector.Connector pause
SEVERE: Protocol handler pause failed
java.net.UnknownHostException: centos5: centos5
at java.net.InetAddress.getLocalHost(InetAddress.java:1426)
at org.apache.jk.common.ChannelSocket.unLockSocket(ChannelSocket.java:490)
at org.apache.jk.common.ChannelSocket.pause(ChannelSocket.java:288)
at org.apache.jk.server.JkMain.pause(JkMain.java:739)
at org.apache.jk.server.JkCoyoteHandler.pause(JkCoyoteHandler.java:153)
at org.apache.catalina.connector.Connector.pause(Connector.java:1138)
at org.apache.catalina.core.StandardService.stop(StandardService.java:578)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:788)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:662)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
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:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Mar 19, 2013 8:17:22 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Mar 19, 2013 8:17:22 AM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
/sbin/runuser: warning: cannot change directory to /usr/share/tomcat5: No such file or directory
Mar 19, 2013 8:17:23 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
Mar 19, 2013 8:17:23 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Mar 19, 2013 8:17:23 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 530 ms
Mar 19, 2013 8:17:24 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 19, 2013 8:17:24 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
Mar 19, 2013 8:17:24 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Mar 19, 2013 8:17:24 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
Mar 19, 2013 8:17:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Mar 19, 2013 8:17:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Mar 19, 2013 8:17:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory sample
Mar 19, 2013 8:17:24 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Mar 19, 2013 8:17:24 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 19, 2013 8:17:24 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/19 config=null
Mar 19, 2013 8:17:24 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 625 ms
有人能帮助我解决这个问题吗?
答案1
未知主机异常表示centos5
找不到名为 host 的主机(请参阅很好的答案)。因此,打开你的/etc/hosts
文件,找到包含的行localhost
,例如:
127.0.0.1 localhost
并像这样附加centos5
到它:
127.0.0.1 localhost centos5
这应该可以解决问题,请反馈。
更新:我刚刚看到第一行:
[root@centos5 tomcat6]# /sbin/service tomcat6 restart
/sbin/runuser: warning: cannot change directory to /usr/share/tomcat5: No such file or directory
您正在启动一个名为 tomcat 的服务6但输出表明找不到 tomcat5目录(据我从链接中了解,这是 CentOS 的默认目录)。看来您的 tomcat 安装不正确,因此我建议重新安装。
但在此之前,请尝试像这样运行它:
/etc/init.d/tomcat6 start
如果仍然不起作用,请卸载 5 和 6:
yum remove tomcat5
yum remove tomcat6
并再次重新安装tomcat6。