1

Getting below error while running a spring boot application. Can anybody help?

Application Class

package com.dell.cns.services.esb.heartbeat.satcps;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan("com.dell.cns.services.esb")
public class CnsServicesHeartBeatSatcpsApplication {

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

Error Message

Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.boot.SpringApplication.run(Ljava/lang/Class;[Ljava/lang/String;)Lorg/springframework/context/ConfigurableApplicationContext;
    at com.dell.cns.services.esb.heartbeat.satcps.CnsServicesHeartBeatSatcpsApplication.main(CnsServicesHeartBeatSatcpsApplication.java:12)
4
  • Can you post your pom.xml file . looks like you have two versions of the same (spring) dependency. Commented Jul 19, 2018 at 9:17
  • You are right that was the issue. Thanks Commented Jul 19, 2018 at 9:37
  • 2
    which duplicate dependency was it? Commented Nov 17, 2018 at 19:01
  • I'm getting the same exception. Could someone help pls. Commented Sep 17, 2019 at 9:13

4 Answers 4

3

If you are using Intellij IDEA, do the following:
Menu -> File -> invalidate cache/restart

Sign up to request clarification or add additional context in comments.

Comments

1

I faced the same issue and fixed it by right-clicking on project->Maven->Update project. The App was then up and running on Tomcat server.

Comments

1

After updating to Java 11 , SpringBoot applications throw many errors. I updated Spring boot version to 2.4.0 and made the changes in main method as below:

ConfigurableApplicationContext context = SpringApplication.run(Application.class,args);

After building and trying to run the application again throws the error like below

"NoSuchMethodError: 'org.springframework.context.ConfigurableApplicationContext org.springframework.boot.SpringApplication.run"

and fixed it by Right click on project -> Maven -> Update maven project

Comments

0

I had a similar error related to Spring Boot and Maven 3.8.* build tool. The solution in my case is to change Maven home path (In ItennliJ IDEA Build Tools) to Bundled (Maven 3)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.