1

These are the relevant pom setting:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.0.6</version>
</parent>
....
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </dependency>

when trying to run the code below from IntelliJ:

@EnableEurekaServer
@SpringBootApplication
public class ServiceRegistrationAndDiscoveryServiceApplication {
  public static void main(String[] args) {
    SpringApplication.run(ServiceRegistrationAndDiscoveryServiceApplication.class, args);
  }
}

it throws error like:

Caused by: java.lang.NoSuchMethodException: org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.<init>()

it seems straightforward but I have no way of finding the jar that contains this class. The document didn't say how it's bundled. A plausible dependency is:

       <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <version>3.0.4</version>
    </dependency>

but looking into its inside, it didn't have the said class even the package name didn't match.

Where is this mysterical jar?

Sergey Tsypanov
  • 3,265
  • 3
  • 8
  • 34
J.E.Y
  • 1,173
  • 2
  • 15
  • 37
  • it's not saying that class is missing, it's saying a certain method is missing. A likely cause is that you have several versions of this method, and the wrong one is being loaded. Or you are calling it with the wrong parameters for this version of the library – Stultuske May 02 '23 at 13:14
  • Considering that Eureka comes from Spring Cloud, it would be very helpful if you show which Spring Cloud version you're using (look in `pom.xml` for `spring-cloud-dependencies` and add this to your question). – g00glen00b May 02 '23 at 13:53

1 Answers1

0

The problem you are facing is one of compatibility issues regarding Spring Boot and Spring Cloud. There's a compatibility matrix demonstrating which pairs of version you should use: Is there a compatibility matrix of Spring-boot and Spring-cloud?

Try updating the versions of your dependencies according to it. I'd recommend to use Spring BOM instead of explicitly defined parent, because use you can import multiple BOMs (in this case for Spring Boot and Spring Cloud) using compatibility matrix, but your project can have only one parent.

In your case it should be

<dependencyManagement>
        <dependencies>
             <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2022.0.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>3.0.6</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
</dependencyManagement>

Sergey Tsypanov
  • 3,265
  • 3
  • 8
  • 34