0
votes

I´m implementing a simple "Hello World" in Spring Boot. I´m following the tutorial SpringBoot HelloWorld

When I run the class SpringbootHelloworldApplication.java as "Run as Java Aplication" I got the error:

*************************** APPLICATION FAILED TO START


Description:

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.

I did double click in the server, and it has this configuration:

enter image description here

I´m not using the port 8080, where should I change the default port?

The server.xml file has:

  <Connector port="8085" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
4
add server.port=<someotherportnumber> in application.properties file - pvpkiran
@pvpkiran What is the path to find that file, please - marhg
read the link u had provided there again. It should be under resources - pvpkiran
I added server.port= 8086 . Again I got an error The Tomcat connector configured to listen on port 8086 failed to start. The port may already be in use or the connector may be misconfigured. - marhg

4 Answers

2
votes

I'm assuming your application looks something like this:

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

Spring Boot runs an embedded Tomcat server. When you run SpringbootHelloworldApplication.java class, it actually starts it's own server. You don't need the Eclipse Tomcat connector at all.

It's possible that you have already launched another instance of your application.

Try setting server.port=0. This will cause Spring Boot to use a random free port every time it starts.

0
votes

yes , you should try with changing it, sometimes http port may have already taken by other applications. change something like 8006 - tomcat port , HTTP - 8086 , AJP - 8010 and do not forgot to navigate with your new http port.

0
votes

you can do one of two things

  1. Add server.port=0 in application.properties file which will randomize your port everytime you run the application but again I wonder why would one want to do that :p

  2. You last application instance wasnt properly stopped and is keeping the port busy.To solve that, on the right top side of the console you will see a red button, click this to stop the application properly and your problem is solved. Note: closing the console doesnt free the port the application was running on. Good day!

0
votes

I think, other applications are take your 8080 port number simple way change your port number in your application.properties file.

server.port = 0