在启动Tomcat的时候,启动到一半提示这样的错误,尤其是在服务器重启以后首次启动tomcat,往往会出现这样的情况:
Server Tomcat v7.0 was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
这个意思就是说tomcat在45秒内是启动不起来的,如果需要更多的时间,那就在服务器的编辑器中把超时调大。
一般来说我们是在一个server.xml这样一个文件中做修改的,注意,这个文件不是tomcat下的那个server.xml配置文件,我们要找的这个文件的具体路径是:
\workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml
其中workspace就是你的工程目录。
打开这个文件以后你看到:
<servers>
<server auto-publish-setting="2" auto-publish-time="1" configuration-id="/Servers/Tomcat v7.0-config" deployDir="wtpwebapps" hostname="localhost" id="Tomcat v7.0" name="Tomcat v7.0" runtime-id="Apache Tomcat v7.0" server-type="org.eclipse.jst.server.tomcat.70" server-type-id="org.eclipse.jst.server.tomcat.70" start-timeout="45" stop-timeout="15" testEnvironment="true" timestamp="1">
<list key="modules" value0="kevin_las::org.eclipse.jst.jee.server:kevin_las::jst.web::3.0"/>
</server>
</servers>
其中start-timeout默认值为45,这就是我们文章标题所提示的错误。那现在既然超时了,就可以把这个数值往大调调,比如start-timeout=”245”,重新启动tomcat,如果还不行,继续往大调,直到tomcat可以正常启动。