• Tomcat启动报错
严重: Failed to initialize end point associated with ProtocolHandler ["http-bio-80"]
java.net.BindException: Address already in use: JVM_Bind <null>:80
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:406)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:610)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:429)
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:981)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:335)
    at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:1091)
    at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:512)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.net.BindException: Address already in use: JVM_Bind
    at java.net.DualStackPlainSocketImpl.bind0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:102)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:513)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:180)
    at java.net.ServerSocket.bind(ServerSocket.java:375)
    at java.net.ServerSocket.<init>(ServerSocket.java:237)
    at java.net.ServerSocket.<init>(ServerSocket.java:181)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:393)
    ... 36 more

这里提示,80端口被占用。

  • springboot启动报错
"D:\Program Files\Java\jdk1.8.0_321\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:61124,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\Fivk\AppData\Local\JetBrains\IntelliJIdea2022.1\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "D:\Program Files\Java\jdk1.8.0_321\jre\lib\charsets.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\deploy.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\access-bridge-64.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\cldrdata.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\dnsns.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\jaccess.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\jfxrt.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\localedata.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\nashorn.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\sunec.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\sunjce_provider.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\sunmscapi.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\sunpkcs11.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\ext\zipfs.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\javaws.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\jce.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\jfr.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\jfxswt.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\jsse.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\management-agent.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\plugin.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\resources.jar;D:\Program Files\Java\jdk1.8.0_321\jre\lib\rt.jar;E:\没用的\实战项目\fivk_takeaway\target\classes;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\boot\spring-boot-starter\2.7.0\spring-boot-starter-2.7.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\boot\spring-boot\2.7.0\spring-boot-2.7.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-context\5.3.20\spring-context-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\boot\spring-boot-autoconfigure\2.7.0\spring-boot-autoconfigure-2.7.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\boot\spring-boot-starter-logging\2.7.0\spring-boot-starter-logging-2.7.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\item_ile\apache-maven-3.8.5\localRepository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\item_ile\apache-maven-3.8.5\localRepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-core\5.3.20\spring-core-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-jcl\5.3.20\spring-jcl-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\boot\spring-boot-starter-web\2.7.0\spring-boot-starter-web-2.7.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\boot\spring-boot-starter-json\2.7.0\spring-boot-starter-json-2.7.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\fasterxml\jackson\core\jackson-databind\2.13.3\jackson-databind-2.13.3.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\fasterxml\jackson\core\jackson-annotations\2.13.3\jackson-annotations-2.13.3.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\fasterxml\jackson\core\jackson-core\2.13.3\jackson-core-2.13.3.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.3\jackson-datatype-jdk8-2.13.3.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.3\jackson-datatype-jsr310-2.13.3.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.3\jackson-module-parameter-names-2.13.3.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\boot\spring-boot-starter-tomcat\2.7.0\spring-boot-starter-tomcat-2.7.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.63\tomcat-embed-core-9.0.63.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.63\tomcat-embed-el-9.0.63.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.63\tomcat-embed-websocket-9.0.63.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-web\5.3.20\spring-web-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-beans\5.3.20\spring-beans-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-webmvc\5.3.20\spring-webmvc-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-aop\5.3.20\spring-aop-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-expression\5.3.20\spring-expression-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\baomidou\mybatis-plus-boot-starter\3.4.2\mybatis-plus-boot-starter-3.4.2.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\baomidou\mybatis-plus\3.4.2\mybatis-plus-3.4.2.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\baomidou\mybatis-plus-extension\3.4.2\mybatis-plus-extension-3.4.2.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\baomidou\mybatis-plus-core\3.4.2\mybatis-plus-core-3.4.2.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\baomidou\mybatis-plus-annotation\3.4.2\mybatis-plus-annotation-3.4.2.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\github\jsqlparser\jsqlparser\4.0\jsqlparser-4.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\mybatis\mybatis\3.5.6\mybatis-3.5.6.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\mybatis\mybatis-spring\2.0.5\mybatis-spring-2.0.5.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\boot\spring-boot-starter-jdbc\2.7.0\spring-boot-starter-jdbc-2.7.0.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\zaxxer\HikariCP\4.0.3\HikariCP-4.0.3.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-jdbc\5.3.20\spring-jdbc-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\springframework\spring-tx\5.3.20\spring-tx-5.3.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\projectlombok\lombok\1.18.20\lombok-1.18.20.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\alibaba\fastjson\1.2.76\fastjson-1.2.76.jar;D:\item_ile\apache-maven-3.8.5\localRepository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\item_ile\apache-maven-3.8.5\localRepository\mysql\mysql-connector-java\8.0.29\mysql-connector-java-8.0.29.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\alibaba\druid-spring-boot-starter\1.1.23\druid-spring-boot-starter-1.1.23.jar;D:\item_ile\apache-maven-3.8.5\localRepository\com\alibaba\druid\1.1.23\druid-1.1.23.jar;D:\item_ile\apache-maven-3.8.5\localRepository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\Program Files\JetBrains\IntelliJ IDEA 2022.1.2\lib\idea_rt.jar" cn.fivk.takeaway.FivkApplication
已连接到目标 VM, 地址: ''127.0.0.1:61124',传输: '套接字''

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.0)

2022-06-11 18:45:37.170  INFO 10444 --- [           main] cn.fivk.takeaway.FivkApplication         : Starting FivkApplication using Java 1.8.0_321 on DESKTOP-FSSSN33 with PID 10444 (E:\没用的\实战项目\fivk_takeaway\target\classes started by Fivk in E:\没用的\实战项目\fivk_takeaway)
2022-06-11 18:45:37.174  INFO 10444 --- [           main] cn.fivk.takeaway.FivkApplication         : No active profile set, falling back to 1 default profile: "default"
2022-06-11 18:45:38.047  INFO 10444 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-06-11 18:45:38.054  INFO 10444 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-06-11 18:45:38.054  INFO 10444 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.63]
2022-06-11 18:45:38.169  INFO 10444 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-06-11 18:45:38.169  INFO 10444 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 956 ms
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
2022-06-11 18:45:38.281  INFO 10444 --- [           main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2022-06-11 18:45:38.366  INFO 10444 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
Property 'mapperLocations' was not specified.
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |     
                        3.4.2 
2022-06-11 18:45:38.827  INFO 10444 --- [           main] cn.fivk.takeaway.config.WebMvcConfig     : 开始进行静态资源映射...
2022-06-11 18:45:39.002  WARN 10444 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 8080 is already in use
2022-06-11 18:45:39.003  INFO 10444 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
2022-06-11 18:45:39.004  INFO 10444 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
2022-06-11 18:45:39.006  INFO 10444 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-06-11 18:45:39.016  INFO 10444 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-06-11 18:45:39.031 ERROR 10444 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 8080 was already in use.

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.

与目标 VM 断开连接, 地址为: ''127.0.0.1:61124',传输: '套接字''

进程已结束,退出代码1

解决方法如下

  1. cmd命令模式下输入netstat -ano,然后找到占用80端口的那个进程 如下图所示

  1. 然后在任务管理器里,查看进程。
  2. 把PID为4的进程关闭掉,然后重新启动Tomcat即可。

最后提醒一下,使用netstat 命令查看端口号时,查看的是Local Address 列的端口号。

此外也可以在服务中,关闭IIS解决

最后修改:2022 年 06 月 11 日
如果觉得我的文章对你有用,请随意赞赏