0

I am starting to learn springboot and already encountered an error. 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

  <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.

3 Answers3

2

If you are using linux/mac, u can try this command :

lsof -i :8080

This will return the process id along with other information, then use the following command to kill the process :

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.

questionaire
  • 2,475
  • 2
  • 14
  • 28
0

The port 8080 in using, you should use another port. You can config in application.properties by setting server.port

pain
  • 319
  • 2
  • 4
  • 18
0

For me just restarting my computer worked. As the error message says some application was already using the specified port.

Risalat Zaman
  • 1,189
  • 1
  • 9
  • 19