Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basic spring boot app not working, showing: Failed to refresh live data from process xxxx

I am beginner for spring boot. I initialized a new project and tried to run it but it does not work successfully. WHen I run this as spring boot application, it starts execution. In bottom compiler/status bar, it shows processing and retrying. it goes upto 10 times and throw the following error:

Failed to refresh live data from process xxxx

More detail here

TanmayTestApplication.java

package com.example.tanmay_test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class TanmayTestApplication {

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

DemoControler.java

package com.example.cntr;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;

@RestController
public class DemoControler {

    @RequestMapping(path = "/index")
    public String index() {
        return "By Tanmay!";
    }   
}

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>tanmay_test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>tanmay_test</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

like image 503
Vinay Bairagi Avatar asked Jan 31 '20 19:01

Vinay Bairagi


People also ask

What is spring boot starter actuator?

Spring Boot Actuator is a sub-project of the Spring Boot Framework. It uses HTTP endpoints to expose operational information about any running application. The main benefit of using this library is that we get health and monitoring metrics from production-ready applications.

What happens with @springbootapplication?

Spring Boot Auto Configuration automatically configures your Spring application based on the JAR dependencies you added in the project. For example, if MySQL database is on your class path, but you have not configured any database connection, then Spring Boot auto configures an in-memory database.

What is spring boot LiveReload?

20.3 LiveReload The spring-boot-devtools module includes an embedded LiveReload server that can be used to trigger a browser refresh when a resource is changed. LiveReload browser extensions are freely available for Chrome, Firefox and Safari from livereload.com.

How do I check spring boot application status?

On system level - you can run your project as a service, which is documented in the Official documentation - Deployments. Then you can query the application status service myapp status .


1 Answers

I had the same problem in STS, and tried different things to resolve it. The following dependency for spring actuator makes that problem disappear, but however the main point of spring actuator provides more features than this. To learn more, click https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html

The dependency should be added to your pom.xml file

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
like image 178
Hashan Mahesh Avatar answered Sep 28 '22 05:09

Hashan Mahesh