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

quarkus-grpc: Generate proto files from dependencies no longer works since Quarkus 3.16 #44384

Closed
mschorsch opened this issue Nov 8, 2024 · 7 comments · Fixed by #44432
Closed
Labels
area/gradle Gradle area/grpc gRPC kind/bug Something isn't working
Milestone

Comments

@mschorsch
Copy link
Contributor

Describe the bug

Since Quarkus 3.16, the generation of proto files from dependencies (https://quarkus.io/guides/grpc-generation-reference#scan-for-proto) no longer works and fails with the following error:

...
Failed to index org.acme.proto.Greeter: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader: PROD for server-1.0.0-SNAPSHOT@6926d1c4
> Task :server:quarkusAppPartsBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':server:quarkusAppPartsBuild'.
> There was a failure while executing work items
   > A failure occurred while executing io.quarkus.gradle.tasks.worker.BuildWorker
      > io.quarkus.builder.BuildException: Build failure: Build failed due to errors
                [error]: Build step io.quarkus.grpc.deployment.GrpcClientProcessor#discoverInjectedClients threw an exception: java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.name()" because "classInfo" is null
                at io.quarkus.grpc.deployment.GrpcClientProcessor.getRawTypeClosure(GrpcClientProcessor.java:468)
                at io.quarkus.grpc.deployment.GrpcClientProcessor.discoverInjectedClients(GrpcClientProcessor.java:189)
                at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
                at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
                at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
                at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
                at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
                at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
                at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
                at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
                at java.base/java.lang.Thread.run(Thread.java:1583)
                at org.jboss.threads.JBossThread.run(JBossThread.java:499)
...

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

  1. reproducer.zip
  2. ./gradlew clean && rm -rf .gradle/ && ./gradlew --stop && ./gradlew clean build --rerun-tasks --no-build-cache --no-parallel --console=plain

Output of uname -a or ver

No response

Output of java -version

Java 21

Quarkus version or git rev

3.16.1

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

Gradle 8.10.2

Additional information

No response

@mschorsch mschorsch added the kind/bug Something isn't working label Nov 8, 2024
@quarkus-bot quarkus-bot bot added the area/grpc gRPC label Nov 8, 2024
Copy link

quarkus-bot bot commented Nov 8, 2024

/cc @alesj (grpc), @cescoffier (grpc)

@mschorsch
Copy link
Contributor Author

All versions from Quarkus 3.16.0 onwards are affected, including the latest version 3.16.2.

@cescoffier
Copy link
Member

I think something changed in our gradle support.

@cescoffier cescoffier added the area/gradle Gradle label Nov 8, 2024
@geoand
Copy link
Contributor

geoand commented Nov 8, 2024

cc @aloubyansky

@mafa73
Copy link

mafa73 commented Nov 8, 2024

I have a similar issue with generated classes from protobuf that is used in reactive messaging when migrating to 3.16.x from 3.15.1:

`What went wrong:
Execution failed for task ':quarkusAppPartsBuild'.

There was a failure while executing work items
A failure occurred while executing io.quarkus.gradle.tasks.worker.BuildWorker
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.smallrye.reactivemessaging.deployment.SmallRyeReactiveMessagingProcessor#build threw an exception: java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.mycompany.user.kafkamodel.proto.TransferWorkitemOuterClass$TransferWorkitem
at io.quarkus.smallrye.reactivemessaging.deployment.QuarkusMediatorConfigurationUtil.load(QuarkusMediatorConfigurationUtil.java:315)
at io.quarkus.smallrye.reactivemessaging.deployment.QuarkusMediatorConfigurationUtil$JandexGenericTypeAssignable.getType(QuarkusMediatorConfigurationUtil.java:400)
at io.quarkus.smallrye.reactivemessaging.deployment.QuarkusMediatorConfigurationUtil$MethodParamGenericTypeAssignable.getType(QuarkusMediatorConfigurationUtil.java:454)
at io.smallrye.reactive.messaging.providers.MediatorConfigurationSupport.validateSubscriber(MediatorConfigurationSupport.java:164)
at io.smallrye.reactive.messaging.providers.MediatorConfigurationSupport.validate(MediatorConfigurationSupport.java:97)
at io.quarkus.smallrye.reactivemessaging.deployment.QuarkusMediatorConfigurationUtil.create(QuarkusMediatorConfigurationUtil.java:140)
at io.quarkus.smallrye.reactivemessaging.deployment.SmallRyeReactiveMessagingProcessor.build(SmallRyeReactiveMessagingProcessor.java:310)
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
at java.base/java.lang.Thread.run(Thread.java:1583)
at org.jboss.threads.JBossThread.run(JBossThread.java:499)
Caused by: java.lang.ClassNotFoundException: com.mycompany.user.kafkamodel.proto.TransferWorkitemOuterClass$TransferWorkitem
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:569)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:517)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:569)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:517)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:534)
at java.base/java.lang.Class.forName(Class.java:513)
at io.quarkus.smallrye.reactivemessaging.deployment.QuarkusMediatorConfigurationUtil.load(QuarkusMediatorConfigurationUtil.java:313)
... 16 more`

@cdsap
Copy link
Contributor

cdsap commented Nov 10, 2024

Hi, sorry for the inconvenience. In version 3.16.1, we updated the QuarkusBuildTask configuration to make it compatible with the configuration cache. These changes required adjustments in how we configure tasks.

In this specific case, the issue is that, during the initial build of the application model in a completely fresh environment (using /gradlew clean && rm -rf .gradle/ && ./gradlew --stop && ./gradlew clean build --rerun-tasks --no-build-cache --no-parallel), the Java compile task does not include the destination output of the gRPC task in its source set. Since we initialize the project descriptor during the configuration phase, the Java compile task does not recognize the gRPC outputs.

To demonstrate this behavior, you can add a Java class in the server module, and you will observe that the issue does not occur because Java compilation can then process the output correctly.

I’ve prepared a quick fix that I need to validate with the Quarkus team.

@quarkus-bot quarkus-bot bot added this to the 3.17 - main milestone Nov 12, 2024
@gsmet gsmet modified the milestones: 3.17 - main, 3.16.3 Nov 12, 2024
@mschorsch
Copy link
Contributor Author

Thanks @cdsap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle area/grpc gRPC kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants