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

Running quarkus:dev requires compile to be included #39773

Closed
kjq opened this issue Mar 28, 2024 · 4 comments
Closed

Running quarkus:dev requires compile to be included #39773

kjq opened this issue Mar 28, 2024 · 4 comments
Labels
area/devmode kind/bug Something isn't working

Comments

@kjq
Copy link

kjq commented Mar 28, 2024

Describe the bug

Originally, using 3.9.0-rc2 we could run mvn quarkus:dev and startup without issues.

We had this before and there was considerable cleanup to the POMs (regrettably use a combination of the Maven CI friendly versions and the Flatten plugin so that we can deploy at the moment).

Now, after upgrading to 3.9.1 we need to run mvn compile quarkus:dev. This seems consistent across all of our services that we may startup. On a side note, they all have jandex indexes and everything works as expected.

The error we are getting is:

[ERROR] io.quarkus.runner.bootstrap.StartupActionImpl (Quarkus Main Thread) Error running Quarkus: java.lang.reflect.InvocationTargetException
        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.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:113)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)
        ... 6 more
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
        ... 15 more
Caused by: java.lang.NoClassDefFoundError: io/quarkus/generated/boolean$quarkusrestparamConverter$
        at io.logicdrop.platform.core.endpoint.PlatformParams.__quarkus_init_converter__debug(PlatformParams.java)
        at io.quarkus.rest.runtime.__QuarkusInit.init(Unknown Source)
        at io.quarkus.resteasy.reactive.server.runtime.ResteasyReactiveRecorder.createDeployment(ResteasyReactiveRecorder.java:152)
        at io.quarkus.deployment.steps.ResteasyReactiveProcessor$setupDeployment713137389.deploy_24(Unknown Source)
        at io.quarkus.deployment.steps.ResteasyReactiveProcessor$setupDeployment713137389.deploy(Unknown Source)
        ... 16 more
Caused by: java.lang.ClassNotFoundException: io.quarkus.generated.boolean$quarkusrestparamConverter$
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:518)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468)
        ... 21 more

Expected behavior

Using mvn quarkus:dev starts up the service.

Actual behavior

Using mvn quarkus:dev throws an CNFE in a BeanParam in another service (which is part of the project). Running mvn compile quarkus:dev starts up the service.

How to Reproduce?

Still investigating and I'm not quite sure yet how to build a reproducer for this but will try.

There are a lot of moving parts the consider and try to replicate in the reproducer.

Output of uname -a or ver

No response

Output of java -version

17.0.6

Quarkus version or git rev

3.9.1

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.9.5

Additional information

Not critical but a nuisance to remember to include compile before quarkus:dev

@kjq kjq added the kind/bug Something isn't working label Mar 28, 2024
@kjq
Copy link
Author

kjq commented Mar 28, 2024

Interesting, it seems to be with anyboolean properties that have a @XXXParam annotation and are used as a @BeanParam.

The original error (and noting it pointed to the debug field in the class) - if I remove the @HeaderParam or debug property it errors on another class that has boolean and is used as a @BeanParam.

An example of one of these fields is:

@HeaderParam("X-Debug")
@Parameter(
        description = "Enable debugging?",
        hidden = false,
        required = false)
private boolean debug;

@kjq
Copy link
Author

kjq commented Mar 28, 2024

Noting, our tests cases against the resources seem to work fine.

@kjq
Copy link
Author

kjq commented Apr 1, 2024

I finally have a reproducer (in my case) and an interesting spin on it.

Reproduce the issue using 3.9.1 (does not work):

  1. Unzip the acme-flatten zip and go into the project
  2. mvn clean install
  3. Go into the service and run mvn quarkus:dev

Rollback Quarkus to 3.9.0.CR2 (works):

  1. Unzip the acme-flatten zip and go into the project
  2. Change the quarkus.version to 3.9.0.CR2
  3. mvn clean install
  4. Go into the service and run mvn quarkus:dev

Run using 3.9.1 without Maven Flatten plugin (works):

  1. Unzip the acme-normal zip and go into the project
  2. mvn clean install
  3. Go into the service and run mvn quarkus:dev

It seems when Iusing the Maven Flatten plugin, because we use Maven version-(un)friendly POMs in combination with the Maven Deploy plugin, I get the issue but without it or using an older version of Quarkus I do not.

acme-normal.zip
acme-flatten.zip

The error using the reproducer is:

2024-04-01 16:20:59,013 ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error running Quarkus: java.lang.reflect.InvocationTargetException
        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.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:113)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)
        ... 6 more
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
        ... 15 more
Caused by: java.lang.NoClassDefFoundError: io/quarkus/generated/boolean$quarkusrestparamConverter$
        at org.acme.core.CoreParams.__quarkus_init_converter__debug(CoreParams.java)
        at io.quarkus.rest.runtime.__QuarkusInit.init(Unknown Source)
        at io.quarkus.resteasy.reactive.server.runtime.ResteasyReactiveRecorder.createDeployment(ResteasyReactiveRecorder.java:152)
        at io.quarkus.deployment.steps.ResteasyReactiveProcessor$setupDeployment713137389.deploy_0(Unknown Source)
        at io.quarkus.deployment.steps.ResteasyReactiveProcessor$setupDeployment713137389.deploy(Unknown Source)
        ... 16 more
Caused by: java.lang.ClassNotFoundException: io.quarkus.generated.boolean$quarkusrestparamConverter$
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:518)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468)
        ... 21 more

@kjq
Copy link
Author

kjq commented Apr 3, 2024

This seems fixed with 3.9.2 - mvn quarkus:dev works without including compile first.

@kjq kjq closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devmode kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants