Eclipse启动tomcat报错,提示三个端口被占用。

Several ports (8005, 8080, 8009) required by Tomcat v8.5 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).

这里提示端口8005,8080,8009被占用。

我首先把eclipse重启一下,启动还是报错,然后到tomcat的bin目录下shutdown.bat关闭一下程序,然后启动还是报错。

排除eclipse和tomcat的问题。

打开window+r输入cmd查看端口被占用情况


也没有发现端口被占用。

在tomcat文件bin目录下startup.bat可以启动。

然后重启了一下电脑,启动tomcat,问题变成了下面的提示


查看控制台有以下错误

Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssm]]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssm]]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@55ade369]
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@7f15654d]
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
Caused by: org.apache.catalina.LifecycleException: A child container failed during start

然后找到maven本地仓库下载的jar包,由于太多直接全部删除,然后打开Eclipse继续maven install,把所有jar下载下来

然后启动tomcat,果然报错变了,对就是变了,不是解决了,天啊。。。

java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V

百度说是slf4j 这个jar引起的问题,slf4j-api.和slf4j-jdk这两个jar直接删除,只使用log4j

然后重新maven clean--》maven install  启动项目发现还是没解决问题

使用的是eclipse也不存在j2ee jar包的问题,查看maven denpendences 发现pom没有写slf4j的内容但是下载了slf4j的jar

应该是隐性依赖引起的依赖冲突,然后查找是什么引起冲突,方法如右边:https://blog.csdn.net/mint6/article/details/80615633

把依赖包含slf4j的jar去掉,重新启动。

perfect!




猜你喜欢

转载自blog.csdn.net/mint6/article/details/80607604