Linux下启动tomcat的时候,如果服务启动不成功,可以到查看logs文件夹下的catalina.out
日志文件,cat我的日志文件可得到如下的错误信息:
cat catalina.out
Error: Exception thrown by the agent : Java.rmi.server.ExportException: Port already in use: 8101; nested exception is:
java.net.BindException: Address already in use
Feb 27, 2011 3:25:39 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load com.funambol.server.tools.directorymonitor.FileChangeEvent. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
从字面上来看,是我的8101端口被占用了,应该是rmi需要用到这个端口,于是使用
netstat -anp
命令来查看各端口被进程占用的情况,这个命令输出包括进程的pid,得到这个pid之后,使用命令:
ps -ef|grep PID
即可查看进程的详细情况。
如果确认此进程可停止的话,
kill pid
重启tomcat就OK了!