Spring Framework Error: Unable to locate or load main class

Asked

Viewed 1,794 times

1

I’m following some lessons from a Spring workshop, but I can’t go on because of the mistake: Unable to locate or load main class. Below is the code containing the main function:

package com.algaworks.vinhos;

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

@SpringBootApplication
public class OficinaSpringFrameworkApplication {

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

Below is the folder structure:

inserir a descrição da imagem aqui

  • How are you running the project? By Maven? Gradle? IDE? Where is this error being displayed?

  • I am running the project through Spring Tool Suite, the error appears in the IDE console. Before compiling a message is displayed warning that the project has errors.

  • You can include the folder structure of your project?

  • Added folder structure in post

1 answer

0

This message in STS could be a Maven repository problem. I already had a project that was working, crashing and starting to make this mistake after downloading other Ibraries to another project. Do Maven - Update Project and wait until the end of STS update, might solve the problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.