Spring boot Axon starter does not use "jakarta.persistence" namespace instead of "javax.persistence" in version 4.6

88 Views Asked by At

I am trying to migrate our application which uses Axon 4.1, with Spring boot 2, and JDK11 to Spring boot 3, with JDK17.

During the upgrade i faced an issue in the build, where Axon's internal classes like AbstractEventEntry, were using javax.persistence.MappedSuperclass.

So when i researched a bit i found this article that the support for "jakarta" namespace is added starting from Axon version 4.6.

But when i used 4.6, i still get the below same error, where Axon's internal classes were using "javax*" rather "jakarta*".

> Task :compileJava FAILED
error: cannot access MappedSuperclass
  class file for javax.persistence.MappedSuperclass not found

What am i missing here, appreciate if anyone could share some insights.

Below is how my POM class looks like, and i use gradle version 8.5 .

buildscript {
    ext {
        springVersion = '6.1.3'
        springBootVersion = '3.2.0'
        springSecurityVersion = '6.2.0'
        junitVersion = "5.3.1"
        axonVersion='4.6.0'
        tomcatVersion='9.0.75'
        oracleVersion = '19.6.0.0'
    }
    repositories {
        mavenCentral()
        mavenLocal()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2"
        classpath "org.junit.platform:junit-platform-gradle-plugin:1.2.0"
        classpath "org.owasp:dependency-check-gradle:$owaspVersion"
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.sonarqube'
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: "org.owasp.dependencycheck"

apply from: "${rootDir}/build-support/packaging.gradle"
apply from: "${rootDir}/contracts/build.gradle"

group = 'com.aconex.relateditems'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

repositories {
    mavenCentral()
    mavenLocal()
    maven {
        name "cegbuacx-public"
        url "https://artifacthub-phx.oci.oraclecorp.com/cegbuacx-public"
    }
}

dependencies {

    implementation ('xerces:xercesImpl:2.12.2')
    implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.2'
    implementation 'org.glassfish.corba:glassfish-corba-orb:4.2.4'
    implementation 'javax.transaction:javax.transaction-api:1.3'
    implementation 'javax.annotation:javax.annotation-api:1.3.2'
    implementation('com.sun.xml.ws:jaxws-ri:4.0.1') {
        exclude module: 'txw2'
        exclude module: 'sdo-eclipselink-plugin'
    }

    implementation ("org.axonframework:axon-spring-boot-starter:$axonVersion"){
        exclude group: 'org.axonframework', module: 'axon-server-connector'
    }

    implementation (group: 'com.aconex', name: 'shared-secrets-implementation', version: '2.0.404') {
        exclude group: 'com.fasterxml.woodstox', module: 'woodstox-core'
    }

    implementation group: 'org.springdoc', name:'springdoc-openapi-ui', version: '1.6.14'
    runtimeOnly  group: 'com.oracle.database.jdbc', name: 'ojdbc8', version: "$oracleVersion"
    runtimeOnly  group: 'com.oracle.database.security', name: 'oraclepki', version: "$oracleVersion"
    runtimeOnly  group: 'com.oracle.database.security', name: 'osdt_cert', version: "$oracleVersion"
    runtimeOnly  group: 'com.oracle.database.security', name: 'osdt_core', version: "$oracleVersion"
    implementation("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion")
    implementation group: 'org.yaml', name: 'snakeyaml', version: '2.0'
    implementation group: 'com.aconex.linkingservice', name: 'dtos', version: '0.2.1'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: "$springBootVersion"
    implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda', version: '2.15.2'
    implementation group: 'com.aconex', name: 'secrets-management-vault-spring', version:'1.5.133'
    implementation group: 'com.aconex', name: 'secrets-management-simple', version: '1.5.133'
    implementation group: 'com.aconex', name: 'secrets-management-tls-common', version: '1.5.133'
    implementation group: 'com.fasterxml.woodstox', name: 'woodstox-core', version: '6.5.1'
    implementation group: 'com.aconex', name: 'spring-pcp-monitoring', version: '0.3.3'
    implementation group: 'net.bull.javamelody', name: 'javamelody-spring-boot-starter', version: '1.79.0'
    implementation group: 'com.aconex', name: 'babylon-private-api-client-common', version: '0.884'
    implementation group: 'org.apache.httpcomponents', name:'httpclient', version: '4.5.13'
    implementation group: 'com.aconex', name: 'trusted-api-client', version: '1.1.57'
    implementation group: 'org.jolokia', name: 'jolokia-core', version: '1.6.1'
    implementation group: 'org.jolokia', name: 'jolokia-spring', version: '1.6.1'


    implementation('org.springframework.boot:spring-boot-starter-web')
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.26'
    annotationProcessor 'org.projectlombok:lombok:1.18.26'

    implementation group: 'com.mikesamuel', name: 'json-sanitizer', version: '1.2.2'
    implementation group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.20'
    implementation group: 'org.burningwave', name: 'core', version: '12.64.1'
    implementation group: 'com.google.guava', name: 'guava', version: '32.0.1-jre'
    implementation group: 'org.reflections', name: 'reflections', version: '0.9.11'
    implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.17.1'
    implementation group: 'org.apache.commons', name: 'commons-configuration2', version: '2.8.0'
    implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
    implementation ('org.dom4j:dom4j:2.1.3'){
        exclude module: 'pull-parser'
    }
    implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.20.0'
    implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.20.0'
    implementation group: 'org.apache.logging.log4j', name: 'log4j-1.2-api', version: '2.20.0'
    implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: "$tomcatVersion"
    implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: "$tomcatVersion"
    implementation group: 'org.apache.tomcat', name: 'tomcat-annotations-api', version: "$tomcatVersion"
    implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-el', version: "$tomcatVersion"

    implementation group: 'org.springframework',name: 'spring-core', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-web', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-webmvc', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-beans', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-context', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-context-support', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-expression', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-tx', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-aop', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-aspects', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-jcl', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-jdbc', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-orm', version: "$springVersion"
    implementation group: 'org.springframework',name: 'spring-test', version: "$springVersion"
    implementation group: 'org.springframework.retry',name: 'spring-retry', version: '1.3.4'

    implementation group: 'org.springframework.security', name: 'spring-security-config', version: "$springSecurityVersion"
    implementation group: 'org.springframework.security', name: 'spring-security-core', version: "$springSecurityVersion"
    implementation group: 'org.springframework.security', name: 'spring-security-test', version: "$springSecurityVersion"
    implementation group: 'org.springframework.security', name: 'spring-security-web', version: "$springSecurityVersion"
    implementation group: 'org.springframework.security', name: 'spring-security-crypto', version: "$springSecurityVersion"

    implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.12'


    implementation group: 'io.pcp.parfait', name: 'dxm', version: '0.5.1'
    implementation group: 'io.pcp.parfait', name: 'parfait-core', version: '0.5.1'
    implementation group: 'io.pcp.parfait', name: 'parfait-jdbc', version: '0.5.1'
    implementation group: 'io.pcp.parfait', name: 'parfait-jmx', version: '0.5.1'
    implementation group: 'io.pcp.parfait', name: 'parfait-pcp', version: '0.5.1'

    runtimeOnly('com.aconex:babylon-contracts:+') {
        exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
        exclude group: 'org.apache.logging.log4j', module: 'log4j-1.2-api'
        exclude group: 'org.liquibase'
    }
    runtimeOnly  group: 'com.aconex.linkingservice', name: 'linking-service-contract', version: '+', changing: true


    testImplementation group: 'org.axonframework', name: 'axon-test', version: "$axonVersion"
    implementation group: 'net.minidev', name: 'json-smart', version: '2.4.10'
    testImplementation('org.junit.jupiter:junit-jupiter-api:5.3.1')
    testImplementation('org.junit.jupiter:junit-jupiter-params:5.3.1')
    testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.3.1')
    testImplementation 'org.mockito:mockito-core:3.11.2'
    testImplementation('org.mockito:mockito-junit-jupiter:2.18.3')
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'junit', module: 'junit'
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    testImplementation 'org.springframework.security:spring-security-test'
    configurations {
        implementation {
            exclude group: 'com.google.j2objc', module:'j2objc-annotations'
            exclude group: 'com.github.spotbugs', module:'3.1.0-RC7'
            exclude group: 'com.google.errorprone', module:'error_prone_annotations'
            exclude group: 'org.checkerframework', module:'checker-qual'
            exclude group: 'org.codehaus.mojo', module:'animal-sniffer-annotations'
        }
    }
}

sonarqube {
    properties {
        property "sonar.host.url", "http://build.engr.acx:9000/sonar"
    }
}

dependencyCheck {
    format = 'ALL'
    suppressionFile = "${rootDir}/owasp/suppressions.xml"
    failBuildOnCVSS = 0
}

task gruntStage(type: Exec) {
    println 'Task :gruntStage: Executing build.sh to build ui(webapp-src).'
    commandLine 'sh', './build.sh'

}

task buildui(type: Copy) {
    dependsOn gruntStage
    println 'Task :buildui: Copying static resources to public'
    from('webapp-src/stage/rsrc')
    into('src/main/resources/public')

}

springBoot {
    buildInfo {
        properties {
            additional = [
                    'srcVersion' : "${buildInformation.tag}"
            ]
        }
    }
}

processResources.dependsOn buildui
1

There are 1 best solutions below

2
Gerard Klijs On

Do you mind sharing based in what information it should be in 4.6? It might be an inconsistency in de docs somewhere. It should be there from 4.7 we also have migration scripts for moving there from Javax.

I'll advise to update to 4.9.2 with the BOM, that should solve the problem.