Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to start LiveReload server

Tags:

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!

like image 585
Adam Kingsley Avatar asked Aug 14 '17 04:08

Adam Kingsley


People also ask

What is LiveReload server in spring boot?

LiveReload: The Spring Boot DevTools module includes an embedded server called LiveReload. It allows the application to automictically trigger a browser refresh whenever we make changes in the resources. It is also known as auto-refresh. Note: We can disable the LiveReload by setting the property spring.

What is LiveReload?

LiveReload is an open source tool that refreshes web pages open in browsers as their source is edited. Immediate and automatic web page refreshing, without the need to manually refresh, simplifies the workflow of web developers. LiveReload consists of server-side and client-side components.


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

like image 158
kossmoboleat Avatar answered Oct 07 '22 00:10

kossmoboleat


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.

like image 29
HammerNL Avatar answered Oct 07 '22 01:10

HammerNL