简体   繁体   English

应用程序无法启动

[英]Application failed to start

I am starting to learn springboot and already encountered an error. 我开始学习springboot并已经遇到错误。 I tried searching for this error, but i wasn't able to find it. 我尝试搜索此错误,但找不到它。 I have inserted the pictures of the entire error as well as my code for the pom.xml and the main class. 我插入了整个错误的图片以及pom.xml和主类的代码。

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>

Main 主要

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);
        }

   }

This was the description for the error: 这是错误的描述:

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 Thank you in advance. 错误错误继续,谢谢。

If you are using linux/mac, u can try this command : 如果您使用的是linux / mac,则可以尝试以下命令:

lsof -i :8080

This will return the process id along with other information, then use the following command to kill the process : 这将返回进程ID以及其他信息,然后使用以下命令终止该进程:

kill -9 your_process_id

This way, you need not to change the port anymore. 这样,您无需再更改端口。

In case the other process is a java process as well, you could also just do jps which shows all running java processes and kill it accordingly. 如果其他进程也是Java进程,则也可以执行jps来显示所有正在运行的Java进程并相应地将其杀死。

The port 8080 in using, you should use another port. 在使用8080端口时,应使用另一个端口。 You can config in application.properties by setting server.port 您可以通过设置server.port在application.properties中进行配置

For me just restarting my computer worked. 对我来说,只需重新启动计算机即可。 As the error message says some application was already using the specified port. 如错误消息所述,某些应用程序已在使用指定的端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM