mongock icon indicating copy to clipboard operation
mongock copied to clipboard

In Java 17+ if a change unit gets any spring beans injected via constructor or into a method argument InaccessibleObjectException is thrown

Open hicnar opened this issue 3 years ago • 11 comments

Description

Java 17 removed --illegal-access=permit and therefore mongock migration does not work

PRIORITY

NORMAL

Version and environment

It is Java 17+ specific

Mongock

  • Mongock version 5.0.39

  • Modules involved - SpringBoot 2.6.7 , MongoDB

  • @EnableMongock annotation is used

  • Environment

any

Steps to Reproduce

Implement a valid change unit class that gets an instance of a bean (MongoTemplate, a service etc) injected via its constructor and run it in Java 17

Behaviour

Expected behavior:

the beans specified in constructor get injected into the implementation of change

Actual behavior:

io.mongock.api.exception.MongockException: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @28eaa59a at io.mongock.runner.core.executor.MongockRunnerImpl.execute(MongockRunnerImpl.java:67) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.springboot.base.MongockApplicationRunner.run(MongockApplicationRunner.java:18) ~[mongock-springboot-base-5.0.39.jar:na] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:768) ~[spring-boot-2.6.7.jar:2.6.7] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:758) ~[spring-boot-2.6.7.jar:2.6.7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-2.6.7.jar:2.6.7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[spring-boot-2.6.7.jar:2.6.7] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.7.jar:2.6.7] at com.my.package.MyWebApplication.main(MyWebApplication.java:16) ~[classes/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.6.7.jar:2.6.7] Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @28eaa59a at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na] at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na] at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[na:na] at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) ~[na:na] at javassist.util.proxy.SecurityActions.setAccessible(SecurityActions.java:103) ~[javassist-3.20.0-GA.jar:na] at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181) ~[javassist-3.20.0-GA.jar:na] at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:164) ~[javassist-3.20.0-GA.jar:na] at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:507) ~[javassist-3.20.0-GA.jar:na] at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:492) ~[javassist-3.20.0-GA.jar:na] at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:428) ~[javassist-3.20.0-GA.jar:na] at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:400) ~[javassist-3.20.0-GA.jar:na] at io.mongock.driver.api.lock.guard.proxy.LockGuardProxyFactory.createProxy(LockGuardProxyFactory.java:92) ~[mongock-driver-api-5.0.39.jar:na] at io.mongock.driver.api.lock.guard.proxy.LockGuardProxyFactory.getRawProxy(LockGuardProxyFactory.java:64) ~[mongock-driver-api-5.0.39.jar:na] at io.mongock.runner.core.executor.dependency.DependencyManager.getDependency(DependencyManager.java:52) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.dependency.DependencyManagerWithContext.getDependency(DependencyManagerWithContext.java:40) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.ChangeLogRuntimeImpl.getParameter(ChangeLogRuntimeImpl.java:113) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.ChangeLogRuntimeImpl.getInvokationParameters(ChangeLogRuntimeImpl.java:101) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.ChangeLogRuntimeImpl.getInstance(ChangeLogRuntimeImpl.java:85) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.operation.migrate.MigrateExecutorBase.getChangeLogInstance(MigrateExecutorBase.java:155) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.operation.migrate.MigrateExecutorBase.processSingleChangeLog(MigrateExecutorBase.java:134) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.operation.migrate.MigrateExecutorBase.processChangeLogs(MigrateExecutorBase.java:126) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.operation.migrate.MigrateExecutorBase.lambda$processMigration$1(MigrateExecutorBase.java:121) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.NonTransactioner.executeInTransaction(NonTransactioner.java:17) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.operation.migrate.MigrateExecutorBase.processMigration(MigrateExecutorBase.java:121) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.operation.migrate.MigrateExecutorBase.executeMigration(MigrateExecutorBase.java:103) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.operation.migrate.MigrateExecutorBase.executeMigration(MigrateExecutorBase.java:46) ~[mongock-runner-core-5.0.39.jar:na] at io.mongock.runner.core.executor.MongockRunnerImpl.execute(MongockRunnerImpl.java:53) ~[mongock-runner-core-5.0.39.jar:na] ... 12 common frames omitted

How often the bug happens: Every time a database migration is attempted

Link to repository using Mongock

Not at liberty to provide links to the repo

hicnar avatar Apr 30 '22 14:04 hicnar

Hello @hicnar ,

We are trying to reproduce this without success. Does this happen when the bean is injected directly in the method as well or just in the constructor?

We have pushed a branch in our examples repository with refactoring ChangeUnit to get dependencies injected via constructor instead of method, and it works fine on both JDK17 and JDK18. Please could you try it?

Repo branch: mongock-examples/issue/#534_jdk17_inaccesible Example project: mongodb/springboot-quickstart

osantana85 avatar May 02 '22 13:05 osantana85

It fails for me no matter if I try to inject via constructor or method, but I have implemented a temporary workaround in which I use a superclass with a static MongoTemplate field that is in turn inherited by my change classes. Ugly, yes, not flexible yes, but it works. I will try your branch and let you know how it went. PS. Updated the priority to NORMAL as a workaround is possible

hicnar avatar May 02 '22 22:05 hicnar

One more thing... what java distribution are you using? I tried on Amazon Corretto installed via sdkman $ java --version openjdk 17.0.3 2022-04-19 LTS OpenJDK Runtime Environment Corretto-17.0.3.6.1 (build 17.0.3+6-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.3.6.1 (build 17.0.3+6-LTS, mixed mode, sharing)

hicnar avatar May 02 '22 22:05 hicnar

We tried with that distribution too and it works fine. Could you provide a small sample project to allow us to reproduce it?

osantana85 avatar May 03 '22 07:05 osantana85

Can you also provide a dependency tree of your project?...with maven you can retrieve it with mvn dependency:tree

dieppa avatar May 03 '22 08:05 dieppa

below's the dependency tree and I will try to work out a minimal example that manifests that problem.

[INFO] my-group-id:my-app:jar:0.0.1-SNAPSHOT [INFO] +- org.springframework.boot:spring-boot-starter-aop:jar:2.6.7:compile [INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.6.7:compile [INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.7:compile [INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.11:compile [INFO] | | | | - ch.qos.logback:logback-core:jar:1.2.11:compile [INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile [INFO] | | | | - org.apache.logging.log4j:log4j-api:jar:2.17.2:compile [INFO] | | | - org.slf4j:jul-to-slf4j:jar:1.7.36:compile [INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile [INFO] | | - org.yaml:snakeyaml:jar:1.29:compile [INFO] | +- org.springframework:spring-aop:jar:5.3.19:compile [INFO] | | - org.springframework:spring-beans:jar:5.3.19:compile [INFO] | - org.aspectj:aspectjweaver:jar:1.9.7:compile [INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.6.7:compile [INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.6.7:compile [INFO] | | +- org.springframework.boot:spring-boot-actuator:jar:2.6.7:compile [INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.2.1:compile [INFO] | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.2:compile [INFO] | | | - com.fasterxml.jackson.core:jackson-core:jar:2.13.2:compile [INFO] | | - com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.2:compile [INFO] | - io.micrometer:micrometer-core:jar:1.8.5:compile [INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile [INFO] | - org.latencyutils:LatencyUtils:jar:2.0.3:runtime [INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb-reactive:jar:2.6.7:compile [INFO] | +- io.projectreactor:reactor-core:jar:3.4.17:compile [INFO] | | - org.reactivestreams:reactive-streams:jar:1.0.3:compile [INFO] | +- org.mongodb:mongodb-driver-reactivestreams:jar:4.4.2:compile [INFO] | | +- org.mongodb:bson:jar:4.4.2:compile [INFO] | | - org.mongodb:mongodb-driver-core:jar:4.4.2:compile [INFO] | - org.springframework.data:spring-data-mongodb:jar:3.3.4:compile [INFO] | +- org.springframework:spring-tx:jar:5.3.19:compile [INFO] | +- org.springframework:spring-context:jar:5.3.19:compile [INFO] | +- org.springframework:spring-expression:jar:5.3.19:compile [INFO] | - org.springframework.data:spring-data-commons:jar:2.6.4:compile [INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:2.6.7:compile [INFO] | - org.mongodb:mongodb-driver-sync:jar:4.4.2:compile [INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.6.7:compile [INFO] | +- org.thymeleaf:thymeleaf-spring5:jar:3.0.15.RELEASE:compile [INFO] | - org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.4.RELEASE:compile [INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity5:jar:3.1.0.M1:compile [INFO] | - org.slf4j:slf4j-api:jar:1.7.36:compile [INFO] +- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:3.1.0:compile [INFO] | +- org.apache.groovy:groovy:jar:4.0.0:compile [INFO] | +- nz.net.ultraq.groovy:groovy-extensions:jar:2.0.0:runtime [INFO] | +- nz.net.ultraq.thymeleaf:thymeleaf-expression-processor:jar:3.1.0:runtime [INFO] | - org.thymeleaf:thymeleaf:jar:3.0.15.RELEASE:compile [INFO] | +- ognl:ognl:jar:3.1.26:compile [INFO] | | - org.javassist:javassist:jar:3.20.0-GA:compile [INFO] | +- org.attoparser:attoparser:jar:2.0.5.RELEASE:compile [INFO] | - org.unbescape:unbescape:jar:1.1.6.RELEASE:compile [INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.6.7:compile [INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.62:compile [INFO] | - org.hibernate.validator:hibernate-validator:jar:6.2.3.Final:compile [INFO] | +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile [INFO] | +- org.jboss.logging:jboss-logging:jar:3.4.3.Final:compile [INFO] | - com.fasterxml:classmate:jar:1.5.1:compile [INFO] +- org.springframework.boot:spring-boot-starter-webflux:jar:2.6.7:compile [INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.6.7:compile [INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.2:compile [INFO] | | - com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.2:compile [INFO] | +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:2.6.7:compile [INFO] | | - io.projectreactor.netty:reactor-netty-http:jar:1.0.18:compile [INFO] | | +- io.netty:netty-codec-http2:jar:4.1.76.Final:compile [INFO] | | +- io.netty:netty-resolver-dns:jar:4.1.76.Final:compile [INFO] | | | - io.netty:netty-codec-dns:jar:4.1.76.Final:compile [INFO] | | +- io.netty:netty-resolver-dns-native-macos:jar:osx-x86_64:4.1.76.Final:compile [INFO] | | | - io.netty:netty-resolver-dns-classes-macos:jar:4.1.76.Final:compile [INFO] | | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.76.Final:compile [INFO] | | - io.projectreactor.netty:reactor-netty-core:jar:1.0.18:compile [INFO] | +- org.springframework:spring-web:jar:5.3.19:compile [INFO] | - org.springframework:spring-webflux:jar:5.3.19:compile [INFO] +- org.springframework.session:spring-session-core:jar:2.6.3:compile [INFO] | - org.springframework:spring-jcl:jar:5.3.19:compile [INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.6.7:runtime (optional) [INFO] | +- org.springframework.boot:spring-boot:jar:2.6.7:compile [INFO] | - org.springframework.boot:spring-boot-autoconfigure:jar:2.6.7:compile [INFO] +- org.projectlombok:lombok:jar:1.18.22:compile (optional) [INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.6.7:compile [INFO] | +- org.springframework.security:spring-security-config:jar:5.6.3:compile [INFO] | - org.springframework.security:spring-security-web:jar:5.6.3:compile [INFO] +- org.apache.commons:commons-lang3:jar:3.12.0:compile [INFO] +- io.mongock:mongock-springboot:jar:5.0.39:compile [INFO] | - io.mongock:mongock-springboot-base:jar:5.0.39:compile [INFO] | +- io.mongock:mongock-spring-base:jar:5.0.39:compile [INFO] | | - io.mongock:mongock-runner-core:jar:5.0.39:compile [INFO] | | +- org.reflections:reflections:jar:0.10.1:compile [INFO] | | - org.apache.maven:maven-artifact:jar:3.6.1:compile [INFO] | | - org.codehaus.plexus:plexus-utils:jar:3.2.0:compile [INFO] | +- io.mongock:mongock-utils:jar:5.0.39:compile [INFO] | - org.springframework.boot:spring-boot-configuration-processor:jar:2.6.7:compile [INFO] +- io.mongock:mongodb-springdata-v3-driver:jar:5.0.39:compile [INFO] | +- io.mongock:mongock-driver-core:jar:5.0.39:compile [INFO] | | - io.mongock:mongock-driver-api:jar:5.0.39:compile [INFO] | | - javax.inject:javax.inject:jar:1:compile [INFO] | +- io.mongock:mongock-api:jar:5.0.39:compile [INFO] | - io.mongock:mongodb-sync-v4-driver:jar:5.0.39:compile [INFO] +- org.apache.commons:commons-collections4:jar:4.4:test [INFO] +- org.springframework.security:spring-security-test:jar:5.6.3:test [INFO] | +- org.springframework.security:spring-security-core:jar:5.6.3:compile [INFO] | | - org.springframework.security:spring-security-crypto:jar:5.6.3:compile [INFO] | +- org.springframework:spring-core:jar:5.3.19:compile [INFO] | - org.springframework:spring-test:jar:5.3.19:test [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.6.7:test [INFO] | +- org.springframework.boot:spring-boot-test:jar:2.6.7:test [INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.6.7:test [INFO] | +- com.jayway.jsonpath:json-path:jar:2.6.0:test [INFO] | | - net.minidev:json-smart:jar:2.4.8:test [INFO] | | - net.minidev:accessors-smart:jar:2.4.8:test [INFO] | | - org.ow2.asm:asm:jar:9.1:test [INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test [INFO] | | - jakarta.activation:jakarta.activation-api:jar:1.2.2:test [INFO] | +- org.assertj:assertj-core:jar:3.21.0:test [INFO] | +- org.hamcrest:hamcrest:jar:2.2:test [INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.8.2:test [INFO] | | - org.junit.jupiter:junit-jupiter-params:jar:5.8.2:test [INFO] | +- org.mockito:mockito-core:jar:4.0.0:test [INFO] | | +- net.bytebuddy:byte-buddy:jar:1.11.22:test [INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.11.22:test [INFO] | | - org.objenesis:objenesis:jar:3.2:compile [INFO] | +- org.mockito:mockito-junit-jupiter:jar:4.0.0:test [INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test [INFO] | | - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test [INFO] | - org.xmlunit:xmlunit-core:jar:2.8.4:test [INFO] +- de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:3.2.5:test [INFO] | +- de.flapdoodle.embed:de.flapdoodle.embed.process:jar:3.1.4:test [INFO] | | +- org.apache.commons:commons-compress:jar:1.21:test [INFO] | | +- net.java.dev.jna:jna:jar:5.9.0:test [INFO] | | - net.java.dev.jna:jna-platform:jar:5.9.0:test [INFO] | - de.flapdoodle:de.flapdoodle.os:jar:1.1.1:test [INFO] +- io.projectreactor:reactor-test:jar:3.4.17:test [INFO] +- org.seleniumhq.selenium:selenium-java:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-api:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-chrome-driver:jar:4.1.1:test [INFO] | | +- com.google.auto.service:auto-service-annotations:jar:1.0.1:test [INFO] | | +- com.google.auto.service:auto-service:jar:1.0.1:test [INFO] | | | - com.google.auto:auto-common:jar:1.2:test [INFO] | | +- org.seleniumhq.selenium:selenium-chromium-driver:jar:4.1.1:test [INFO] | | - org.seleniumhq.selenium:selenium-json:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-devtools-v85:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-devtools-v94:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-devtools-v95:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-devtools-v96:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-edge-driver:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-firefox-driver:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-firefox-xpi-driver:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-ie-driver:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-opera-driver:jar:4.1.1:test [INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:4.1.1:test [INFO] | | +- io.netty:netty-buffer:jar:4.1.76.Final:compile [INFO] | | +- io.netty:netty-codec-http:jar:4.1.76.Final:compile [INFO] | | | +- io.netty:netty-codec:jar:4.1.76.Final:compile [INFO] | | | - io.netty:netty-handler:jar:4.1.76.Final:compile [INFO] | | +- io.netty:netty-common:jar:4.1.76.Final:compile [INFO] | | +- io.netty:netty-transport-classes-epoll:jar:4.1.76.Final:compile [INFO] | | +- io.netty:netty-transport-classes-kqueue:jar:4.1.76.Final:test [INFO] | | +- io.netty:netty-transport-native-unix-common:jar:4.1.76.Final:compile [INFO] | | +- io.netty:netty-transport:jar:4.1.76.Final:compile [INFO] | | | - io.netty:netty-resolver:jar:4.1.76.Final:compile [INFO] | | +- io.opentelemetry:opentelemetry-api:jar:1.9.1:test [INFO] | | +- io.opentelemetry:opentelemetry-context:jar:1.9.1:test [INFO] | | +- io.opentelemetry:opentelemetry-exporter-logging:jar:1.9.1:test [INFO] | | | +- io.opentelemetry:opentelemetry-sdk-metrics:jar:1.9.1-alpha:test [INFO] | | | - io.opentelemetry:opentelemetry-sdk-logs:jar:1.9.1-alpha:test [INFO] | | +- io.opentelemetry:opentelemetry-sdk-common:jar:1.9.1:test [INFO] | | +- io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:jar:1.9.1:test [INFO] | | +- io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:jar:1.9.1-alpha:test [INFO] | | +- io.opentelemetry:opentelemetry-sdk-trace:jar:1.9.1:test [INFO] | | | - io.opentelemetry:opentelemetry-api-metrics:jar:1.9.1-alpha:test [INFO] | | +- io.opentelemetry:opentelemetry-sdk:jar:1.9.1:test [INFO] | | +- io.opentelemetry:opentelemetry-semconv:jar:1.9.1-alpha:test [INFO] | | +- io.ous:jtoml:jar:2.0.0:test [INFO] | | +- org.apache.commons:commons-exec:jar:1.3:test [INFO] | | +- org.asynchttpclient:async-http-client:jar:2.12.3:test [INFO] | | | +- org.asynchttpclient:async-http-client-netty-utils:jar:2.12.3:test [INFO] | | | +- io.netty:netty-codec-socks:jar:4.1.76.Final:compile [INFO] | | | +- io.netty:netty-handler-proxy:jar:4.1.76.Final:compile [INFO] | | | +- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.76.Final:test [INFO] | | | +- com.typesafe.netty:netty-reactive-streams:jar:2.0.4:test [INFO] | | | - com.sun.activation:jakarta.activation:jar:1.2.2:test [INFO] | | - org.seleniumhq.selenium:selenium-http:jar:4.1.1:test [INFO] | | - net.jodah:failsafe:jar:2.4.4:test [INFO] | +- org.seleniumhq.selenium:selenium-safari-driver:jar:4.1.1:test [INFO] | - org.seleniumhq.selenium:selenium-support:jar:4.1.1:test [INFO] +- io.github.bonigarcia:webdrivermanager:jar:5.0.3:test [INFO] | +- com.google.code.gson:gson:jar:2.8.9:compile [INFO] | +- org.jsoup:jsoup:jar:1.14.2:test [INFO] | +- com.github.docker-java:docker-java:jar:3.2.12:test [INFO] | | +- com.github.docker-java:docker-java-core:jar:3.2.12:test [INFO] | | | +- com.github.docker-java:docker-java-api:jar:3.2.12:test [INFO] | | | +- commons-io:commons-io:jar:2.6:test [INFO] | | | +- commons-lang:commons-lang:jar:2.6:test [INFO] | | | - org.bouncycastle:bcpkix-jdk15on:jar:1.64:test [INFO] | | | - org.bouncycastle:bcprov-jdk15on:jar:1.64:test [INFO] | | - org.slf4j:jcl-over-slf4j:jar:1.7.36:test [INFO] | +- com.github.docker-java:docker-java-transport-httpclient5:jar:3.2.12:test [INFO] | | +- com.github.docker-java:docker-java-transport:jar:3.2.12:test [INFO] | | - org.apache.httpcomponents.client5:httpclient5:jar:5.1.3:test [INFO] | | +- org.apache.httpcomponents.core5:httpcore5:jar:5.1.3:test [INFO] | | - commons-codec:commons-codec:jar:1.15:test [INFO] | +- com.google.guava:guava:jar:30.1.1-jre:compile [INFO] | | +- com.google.guava:failureaccess:jar:1.0.1:compile [INFO] | | +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile [INFO] | | +- org.checkerframework:checker-qual:jar:3.8.0:compile [INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.5.1:compile [INFO] | | - com.google.j2objc:j2objc-annotations:jar:1.3:compile [INFO] | - org.brotli:dec:jar:0.1.2:test [INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test [INFO] | +- org.opentest4j:opentest4j:jar:1.2.0:test [INFO] | +- org.junit.platform:junit-platform-commons:jar:1.8.2:test [INFO] | - org.apiguardian:apiguardian-api:jar:1.1.2:test [INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test [INFO] | - org.junit.platform:junit-platform-engine:jar:1.8.2:test [INFO] +- org.junit.platform:junit-platform-launcher:jar:1.8.2:test [INFO] +- org.junit.platform:junit-platform-suite:jar:1.8.2:test [INFO] | +- org.junit.platform:junit-platform-suite-api:jar:1.8.2:test [INFO] | - org.junit.platform:junit-platform-suite-engine:jar:1.8.2:test [INFO] | - org.junit.platform:junit-platform-suite-commons:jar:1.8.2:test [INFO] +- io.cucumber:cucumber-java:jar:7.2.3:test [INFO] | - io.cucumber:cucumber-core:jar:7.2.3:test [INFO] | +- io.cucumber:cucumber-gherkin:jar:7.2.3:test [INFO] | +- io.cucumber:cucumber-gherkin-messages:jar:7.2.3:test [INFO] | +- io.cucumber:messages:jar:17.1.1:test [INFO] | +- io.cucumber:tag-expressions:jar:4.1.0:test [INFO] | +- io.cucumber:cucumber-expressions:jar:15.0.1:test [INFO] | +- io.cucumber:datatable:jar:7.2.3:test [INFO] | +- io.cucumber:cucumber-plugin:jar:7.2.3:test [INFO] | +- io.cucumber:docstring:jar:7.2.3:test [INFO] | +- io.cucumber:html-formatter:jar:17.0.0:test [INFO] | - io.cucumber:ci-environment:jar:8.1.0:test [INFO] +- io.cucumber:cucumber-spring:jar:7.2.3:test [INFO] +- io.cucumber:cucumber-testng:jar:7.2.3:test [INFO] +- io.cucumber:cucumber-junit:jar:7.2.3:test [INFO] | - junit:junit:jar:4.13.2:test [INFO] | - org.hamcrest:hamcrest-core:jar:2.2:test [INFO] +- io.cucumber:cucumber-junit-platform-engine:jar:7.2.3:test [INFO] - org.testng:testng:jar:7.5:test [INFO] +- com.google.code.findbugs:jsr305:jar:3.0.1:compile [INFO] +- com.beust:jcommander:jar:1.78:test [INFO] - org.webjars:jquery:jar:3.5.1:test

hicnar avatar May 03 '22 11:05 hicnar

I have just cloned and run your example and it worked! I had to disable transactions as there was this replica set problem and mongo not supporting retryable writes business, but once I disabled the transactions it worked under Amazon Corretto. I will try to produce a sample project that exhibits the problem mentioned. Will keep you informed!

hicnar avatar May 03 '22 23:05 hicnar

@osantana85 @dieppa Folks, I think the easiest thing to do would be if I sort of changed my mind when it comes not to sharing the repo and temporarily added the one who is working on this issue to that repo as a collaborator so that you can check out the project and run it on your machine. I am also happy to meet you on zoom or skype and do a little demo. Regarding the timezone I am based in London.

hicnar avatar May 04 '22 21:05 hicnar

Hello @hicnar , sorry for the delay. It has been a busy month. Having in mind that you are not using Mongock in a commercial project and we have been pretty focused in delivering some features we have committed to, we haven't been able to take a look to this. Being honest, I would try to take a look in the next weeks, but I can't promise.

dieppa avatar Jun 01 '22 20:06 dieppa

No worries man. I have a workaround so there's no rush. I have granted you access to the project I am working on and you should be able to reproduce it and fix it in when time allows.

hicnar avatar Jun 01 '22 23:06 hicnar

I was running into the exact same issue, and it ended up being a problem with an older version of javassist being pulled in. It looks like we are both getting it from the same dependency too:

[INFO] +- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:3.1.0:compile
[INFO] |  \- org.thymeleaf:thymeleaf:jar:3.0.15.RELEASE:compile
[INFO] |     |  \- org.javassist:javassist:jar:3.20.0-GA:compile

I excluded javassist from thymeaf-layout-dialect and things seem to be working now, though admittedly I haven't battle tested to see if it affects thymeleaf in any way.

<dependency>
    <groupId>nz.net.ultraq.thymeleaf</groupId>
    <artifactId>thymeleaf-layout-dialect</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
        </exclusion>
    </exclusions>
</dependency>

javassist now resolves to the mongock-specified version, which for mongock 5.1.4 is javassist 3.28.0-GA

bpfoster avatar Aug 22 '22 13:08 bpfoster

I had the same issue when trying to inject MongoTemplate or MongoOperations in a change unit class. As @bpfoster suggested, I resolved the issue by excluding dependency on an older version of javassist 3.21.0-GA (it was required by json-fixtures-lib). The javassist which is used is 3.28.0-GA

Version and environment Java 17 Mongock version 5.3.2 Modules involved - SpringBoot 3.1.1 , MongoDB

lilia-sg avatar Jul 25 '23 11:07 lilia-sg