javamavenpom.xmlquarkus

Quarkus: EnumConstantNotPresentException at runtime


I'm asking for your help today because I'm having problems with my Quarkus upgrade from version 2.11 to 3.6. During this change, I got the following logs:

2023-12-01 14:58:53,946 INFO  [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2023-12-01 14:58:54,378 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.EnumConstantNotPresentException: io.quarkus.runtime.annotations.ConfigPhase.BOOTSTRAP
    at java.base/sun.reflect.annotation.EnumConstantNotPresentExceptionProxy.generateException(EnumConstantNotPresentExceptionProxy.java:47)
    at java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:89)
    at jdk.proxy2/jdk.proxy2.$Proxy2.phase(Unknown Source)
    at io.quarkus.deployment.configuration.BuildTimeConfigurationReader.<init>(BuildTimeConfigurationReader.java:201)
    at io.quarkus.deployment.configuration.BuildTimeConfigurationReader.<init>(BuildTimeConfigurationReader.java:137)
    at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:136)
    at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:107)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:330)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:251)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:112)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:433)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:55)
    at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
    at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
    at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
    at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)

Here are also the dependencies contained in my pom.xml:

    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.28</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>1.5.5.Final</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>1.5.5.Final</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-arc</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-resteasy-reactive-jackson</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-config-yaml</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-elytron-security-common</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-smallrye-openapi</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-hibernate-validator</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-smallrye-jwt</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-smallrye-jwt-build</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-hibernate-orm-panache</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jdbc-postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-flyway</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-rest-client-reactive</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-rest-client-reactive-jackson</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkiverse.hibernatetypes</groupId>
            <artifactId>quarkus-hibernate-types</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit5</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.quarkiverse.googlecloudservices</groupId>
            <artifactId>quarkus-google-cloud-storage</artifactId>
            <version>2.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.cloud.sql</groupId>
            <artifactId>postgres-socket-factory</artifactId>
            <version>1.11.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>2.8.0</version>
        </dependency>
        <dependency>
            <groupId>net.coobird</groupId>
            <artifactId>thumbnailator</artifactId>
            <version>0.4.20</version>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-mailer</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-websockets</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-scheduler</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkiverse.bucket4j</groupId>
            <artifactId>quarkus-bucket4j</artifactId>
            <version>1.0.1</version>
        </dependency>
    </dependencies>

In order to verify that this was a dependency problem, I created a new, blank Quarkus 3.6 project and ran it, without a hitch. When I added my project's dependencies to the new test project, I got the same error this time. So I'm wondering which library is causing the problem and how to fix it?

Thank you for your time and invaluable help!

(I thought of a quarkus library that is no longer maintained in version 3)


Solution

  • There is not enough information on the message or dependencies to tell as is

    My guess is that indeed, its one of your dependencies that is trying to read configuration at ConfigPhase.BOOTSTRAP that was present in v2 and is no longer there in v3 for whatever reason

    You can try updating the offending dependency by removing <version> from everything, since not pinning it may bring a newer updated compatible version, make sure to clean maven cache and pin versions afterwards

    Otherwise you may have to:

    • reasearch each one manually (only quarkus specific ones though)
    • remove each one by one until you find the offending one
    • add dependencies on your new v3 project until one breaks at dev mode

    Worst case scenario one of your dependencies is plain not compatible and you must either delay migration or submit a PR or find an alternative. If I had to guess, the offending dependency is one of:

    1. quarkus-hibernate-types
    2. quarkus-google-cloud-storage
    3. quarkus-bucket4j

    Best of luck!