Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application Startup Fails with ExceptionInInitializerError When Using Kotlin DSL and Quartz in Jmix 2.4.1 #3927

Open
nekozlov opened this issue Nov 25, 2024 · 0 comments
Labels
in: core size: M type: bug Something isn't working

Comments

@nekozlov
Copy link

Bug Description:
When adding Quartz to a project written in Kotlin (version 2.0.21) and creating the following class:

import kotlin.reflect.KClass

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
@DslMarker
annotation class DataDslMarker

@DataDslMarker
interface DataDsl {

    fun <E : Any> create(entityClass: KClass<E>): E

    fun <E : Any> save(entity: E): E
}

inline fun <reified E : Any> DataDsl.create(init: @DataDslMarker E.() -> Unit = {}) = create(E::class).apply(init)

During application startup, JmixModulesClasspathScanner#candidateDetectors adds a bean of the QuartzJobClassFinder class. In the JmixModulesClasspathScanner#init method, a MetadataReader is created for the DataDslMarker with metadataReader.getClassMetadata().getClassName() returning com.my.project.util.data.DataDslKt$create$1.

When Class.forName(metadataReader.getClassMetadata().getClassName()) is executed in QuartzJobDetector#isCandidate, it throws a java.lang.ExceptionInInitializerError exception, causing the application to fail during initialization.

@nekozlov nekozlov added triage Issue is waiting for triage type: bug Something isn't working labels Nov 25, 2024
@glebfox glebfox added size: M and removed triage Issue is waiting for triage labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core size: M type: bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants