Skip to content

spring-boot4.0.0,spring-cloud2025.1.0 and alibaba-nacos-discovery2025.0.0.0 #4183

Description

@723854867

In the three versions I mentioned above, for the demo, the dependencies are as follows:


org.springframework.boot
spring-boot-starter-web

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    <version>2025.0.0.0</version>
</dependency>
The spring-boot-starter-web is version 4.0.0. The main startup class is as follows:

package org.hyper.demo.spring.microservice.alinacos.server;

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

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

After configuring spring.cloud.nacos.discovery.xxx, the following error occurs during startup:

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration.<init>(NacosAutoServiceRegistration.java:46)

The following method did not exist:

'void org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.<init>(org.springframework.cloud.client.serviceregistry.ServiceRegistry, org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationProperties)'

The calling method's class, com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration, was loaded from the following location:

jar:file:/Users/Xinlin.Zhang/.m2/repository/com/alibaba/cloud/spring-cloud-starter-alibaba-nacos-discovery/2025.0.0.0/spring-cloud-starter-alibaba-nacos-discovery-2025.0.0.0.jar!/com/alibaba/cloud/nacos/registry/NacosAutoServiceRegistration.class

The called method's class, org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration, is available from the following locations:

jar:file:/Users/Xinlin.Zhang/.m2/repository/org/springframework/cloud/spring-cloud-commons/5.0.0/spring-cloud-commons-5.0.0.jar!/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistration.class

The called method's class hierarchy was loaded from the following locations:

org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration: file:/Users/Xinlin.Zhang/.m2/repository/org/springframework/cloud/spring-cloud-commons/5.0.0/spring-cloud-commons-5.0.0.jar

Action:

Correct the classpath of your application so that it contains compatible versions of the classes com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration and org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions