Unable to start LiveReload server

Viewed 20803

I download the source demo code from spring-boot website when i import in the Intelj idea and start the application, the console has a WARN,which says

2017-08-14 12:23:23.609 WARN 2356 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : Unable to start LiveReload server

although the application was working, I still wanna know why it has this WARN!

2 Answers

In my case I have two Spring Boot services running simultaneously too. Of course disabling the live-reload completely will work, but there's also a property you can set to choose a different port.

Simply add the following to your application.yml (or properties equivalent). The default is 35729.

spring: devtools: livereload: port: 35730

I ran into this issue too. Like you said, it's not preventing your app from working properly, it's just that I'd like to avoid warnings wherever possible (especially the ones I can not explain!).

In my case I'm running 2 Spring Boot applications simultaneously, which is exactly the reason for this warning. The LiveReload server is then also started twice, while the port it wants to use (35729) can obviously be bound to only once.

So I started looking for a way to change the LiveReload server port for one of my two applications. The best I could find is:

http://livereload.com/tips/change-port-number-livereload-listens-on/

The option where I would need to set an environment variable LRPortOverride containing the new port number seemed feasible to me. However, no matter what I tried, my environment variable was simply ignored. So no cigar there :-(

Thus, my search continued and I finally found this:

https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html#using-boot-devtools-livereload

This confirms my conclusion and also provides a solution for my problem. I simply added

spring.devtools.livereload.enabled=false

to the Spring application.properties of one of my applications, and the issue was fixed.

Hope this will help you too.

Related