java – module does not open unanmed module using quarkus and mongock

I get the following issue when starting up quarkus with mongock on java 17:

2022-07-22 07:50:57,109 ERROR [io.mon.run.cor.exe.MongockRunnerImpl] (main) Error in mongock process. ABORTED MIGRATION: 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 @3c87521
    at io.mongock.runner.core.executor.MongockRunnerImpl.execute(MongockRunnerImpl.java:67)
    at mt.com.my.proj.quarkus.commons.db.mongo.migration.MongoMigrationManager.init(MongoMigrationManager.java:89)
    at mt.com.my.proj.quarkus.commons.db.mongo.migration.MongoMigrationManager_Bean.create(Unknown Source)
    at mt.com.my.proj.quarkus.commons.db.mongo.migration.MongoMigrationManager_Bean.create(Unknown Source)
    at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:111)
    at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
    at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:32)
    at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
    at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
    at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:32)
    at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:18)
    at mt.com.my.proj.quarkus.commons.db.mongo.migration.MongoMigrationManager_ClientProxy.arc$delegate(Unknown Source)
    at mt.com.my.proj.quarkus.commons.db.mongo.migration.MongoMigrationManager_ClientProxy.arc_contextualInstance(Unknown Source)
    at mt.com.my.proj.quarkus.commons.db.mongo.migration.MongoMigrationManager_Observer_Synthetic_d70cd75bf32ab6598217b9a64a8473d65e248c05.notify(Unknown Source)
    at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:323)
    at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:305)
    at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:73)
    at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:130)
    at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:99)
    at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
    at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
    at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
    at io.quarkus.runtime.Application.start(Application.java:101)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:103)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
    at mt.com.my.proj.tenant.TenantGeoConfigServiceApplication.main(TenantGeoConfigServiceApplication.java:13)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:60)
    at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:31)
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 @3c87521
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
    at javassist.util.proxy.SecurityActions.setAccessible(SecurityActions.java:103)
    at javassist.util.proxy.DefineClassHelper.toClass3(DefineClassHelper.java:151)
    at javassist.util.proxy.DefineClassHelper.toClass2(DefineClassHelper.java:134)
    at javassist.util.proxy.DefineClassHelper.toClass(DefineClassHelper.java:95)
    at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:131)
    at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:530)
    at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:515)
    at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:451)
    at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:422)
    at io.mongock.driver.api.lock.guard.proxy.LockGuardProxyFactory.createProxy(LockGuardProxyFactory.java:92)

I am using quarkus version 2.9.0.CR1 and mongock version 5.1.0

I have migrtation scripts that inject the following objects (only, no other custom defined objects)

@ChangeUnit(id = "create-global-config", order = "6", author = "me")
public record Migration006GlobalConfigCreation(ClientSession clientSession, ReactiveMongoDatabase mongoDatabase) {

Leave a Comment