java - 应用程序无法启动

标签 java maven spring-boot

我开始学习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/

相关文章:

javax.ws.rs.ProcessingException : could not find writer for content-type application/x-www-form-urlencoded type

java - Intellij IDEA 中 Apache POI 的依赖关系存在问题。不一致的错误

java - 尝试使用 ElasticSearch 存储和获取一些数据

c# - 连接 C# 和 Java 的最佳方式是什么?

java - 重复使用 Scanner.hasNextLine()

窗口打开时运行的 Java 方法

android - 您如何将本地Maven m2作为属性传递给Gradle?

java - Sonatype Nexus 3 - 获取最新快照

java - 在 tomcat7 上部署为 war 的 Spring Boot 应用程序失败,错误为 "More than one fragment with the name [org_apache_tomcat_websocket] was found"

java - 在 POST 请求上验证表单时出现问题(Spring Boot)