我开始学习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
Error , Error Continued 预先感谢您。
最佳答案
如果你使用的是linux/mac,你可以尝试这个命令:
lsof -i :8080
这将返回进程 ID 以及其他信息,然后使用以下命令终止该进程:
kill -9 your_process_id
这样,您就无需再更改端口了。
如果另一个进程也是 java 进程,您也可以执行 jps
来显示所有正在运行的 java 进程并相应地终止它。
关于java - 应用程序无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49419891/