[英]Application failed to start
我开始学习springboot并已经遇到错误。 我尝试搜索此错误,但找不到它。 我插入了整个错误的图片以及pom.xml和主类的代码。
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
</project>
主要
package io.java.springbootstarter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CourseApiApp {
public static void main(String[] args) {
SpringApplication.run(CourseApiApp.class, args);
}
}
这是错误的描述:
The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
2018-03-21 22:47:48.794 INFO 9412 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@f75083: startup date [Wed Mar 21 22:47:46 EDT 2018]; root of context hierarchy
2018-03-21 22:47:48.794 INFO 9412 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
如果您使用的是linux / mac,则可以尝试以下命令:
lsof -i :8080
这将返回进程ID以及其他信息,然后使用以下命令终止该进程:
kill -9 your_process_id
这样,您无需再更改端口。
如果其他进程也是Java进程,则也可以执行jps
来显示所有正在运行的Java进程并相应地将其杀死。
在使用8080端口时,应使用另一个端口。 您可以通过设置server.port在application.properties中进行配置
对我来说,只需重新启动计算机即可。 如错误消息所述,某些应用程序已在使用指定的端口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.