I include spring-cloud-starter-netflix-hystrix in my project, when I run

mvn spring-boot:run

It throw exception: Spring Cloud Netflix Failed to instantiate [com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect]: Factory method 'hystrixCommandAspect' threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint: org.aspectj.lang.JoinPoint

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.7.RELEASE:run (default-cli) on project spring-cloud-app1: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'hystrixCommandAspect' defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect]: Factory method 'hystrixCommandAspect' threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/JoinPoint: org.aspectj.lang.JoinPoint -> [Help 1]

the pom.xml:

<artifactId>spring-cloud-app1</artifactId>
<groupId>com.doing</groupId>
<version>1.0-SNAPSHOT</version>
<modelVersion>4.0.0</modelVersion>

<properties>
    <java.version>1.8</java.version>
    <spring-boot-starter-test.version>1.5.10.RELEASE</spring-boot-starter-test.version>
    <spring-cloud-starter.version>1.4.3.RELEASE</spring-cloud-starter.version>
</properties>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.7.RELEASE</version>
</parent>

<dependencies>
    <!--spring boot-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>1.5.10.RELEASE</version>
    </dependency>

    <!-- spring boot junit test -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${spring-boot-starter-test.version}</version>
        <scope>test</scope>
    </dependency>

    <!-- spring cloud eureka client -->
    <!--old : spring-cloud-starter-eureka-->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        <version>${spring-cloud-starter.version}</version>
    </dependency>

    <!-- spring cloud ribbon -->
    <!--old : spring-cloud-starter-ribbon-->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
        <version>${spring-cloud-starter.version}</version>
    </dependency>

    <!--spring cloud netflix-->
    <!--old: spring-cloud-starter-hystrix-->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
        <version>${spring-cloud-starter.version}</version>
    </dependency>

</dependencies>

<!-- Package as an executable JAR -->
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Comment From: DoingLee

solved by:

    <parent>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-parent</artifactId>
        <version>Camden.SR7</version> 
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

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

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>

         ...
    </dependencies>

Comment From: ekmobile

I'd like to bring this up again, since we have a similar problem. On macOS Big Sur, the build creates different module directories than in an openjdk:8-jdk Docker image:

Bildschirmfoto 2021-01-13 um 09 57 38

On macOS the following is executed:

rm -rf $HOME/.gradle/caches/ rm -rf build ./gradlew build

The Docker Command is:

docker run -v $(pwd):/app openjdk:8-jdk bash -c 'cd app && ./gradlew build'

They both use openjdk version "1.8.0_275" the Gradle version is the same.

Why does the build generate different module directories, when everything else (except the OS) is the same?

Comment From: ekmobile

@DoingLee can you reopen the issue?