今天在maven工程下使用tomcat启动项目时,一直报错,报错内容就是tomcat启动不了,一启动就报如下错:
Publishing failed
Could not publish to the server.
java.lang.IndexOutOfBoundsException
Could not publish server configuration: D:\workspace-sts\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\server.xml (系统找不到指定的路径。).
Publishing failed
Could not publish to the server.
java.lang.IndexOutOfBoundsException
Could not publish server configuration: D:\workspace-sts\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\server.xml (系统找不到指定的路径。).
D:\workspace-sts\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\server.xml (系统找不到指定的路径。)
而且在网上看了很多人都有提问,但没有一个准确的答复,于是自己不断查,不断尝试,最后得以解决:
解决办法就是:
1、关闭eclipse;
2、找到m2这个文件夹,然后将其删掉,然后再打开eclipse,点击项目maven install,再重新启动项目即可;
本人分析可能因为之前maven工程下载的依赖和刚导入的项目的依赖版本有冲突,所以导致tomcat无法正常启动,当然我之前学习java中的keytool,修改过tomcat的config目录中的server.xml文件里面,将
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\Users\heyongjian\.keystore" keystorePass="123456"
/>
注释取消了,默认是注释掉了,若没有注释,这样也会导致tomcat无法正常启动。