Reputation: 2011
Am getting the below error while starting my spring-boot application . This is my first spring-boot project. so, am not sure about the error and how to fix it.
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.
2018-04-28 21:42:16.248 INFO 13196 --- [lication.main()] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@57ac5b74: startup date [Sat Apr 28 21:42:11 IST 2018]; root of context hierarchy
2018-04-28 21:42:16.249 INFO 13196 --- [lication.main()] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:423)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.boot.context.embedded.tomcat.ConnectorStartFailedException: Connector configured to listen on port 8080 failed to start
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.checkThatConnectorsHaveStarted(TomcatEmbeddedServletContainer.java:222)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:198)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.journaldev.elasticsearch.Elastic6Application.main(Elastic6Application.java:12)
... 6 more
Upvotes: 1
Views: 2659
Reputation: 187
Run sudo lsof -i tcp:8080
to get the PID and then kill the process using kill -9 xxxxx
where "xxxxx" is your PID and now you can restart your application at port 8080
Change your application's server port to something other than 8080. You can do this by going to application.properties and typing server.port = xxxx
where xxxx
is the port you want to run your application at. You can also type server.port=0
this will allocate a random port which is available. You can find the port in your logs while the application starts and run your application at that port
Upvotes: 1
Reputation: 31
Use some other port. Manually configure the port in the application.properties like below server.port=8082 or some other port.
Upvotes: 0
Reputation: 1501
Run lsof -n -i4TCP:8080
to find PID of the process that use 8080. You will get an output something like that:
COMMAND PID USER FD TYPE NODE NAME
java 72180 hisener 223u IPv6 TCP *:http-alt (LISTEN)
And then run kill -9 72180
to kill the process. (Change 72180 to your PID).
Now, you should be able to run your spring boot application.
For windows, the equivalent of commands above:
Find PID of process that use a port: netstat -aon | find "8080"
Kill the process by PID: taskkill /F /PID 72180
Upvotes: 3
Reputation: 145
I assume that you have already a process that is listening on port 8080. Have a look for a java (or others) process in your process table and kill it. This happens sometimes when spring boot doesn't stop and run in the background
Upvotes: 0