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

Reactive REST Client breaks with ClassFormatError if attribute is present in interface #23010

Closed
markusdlugi opened this issue Jan 19, 2022 · 4 comments
Labels
area/rest-client env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@markusdlugi
Copy link
Contributor

Describe the bug

Since Quarkus 2.5.1.Final we experience a regression that the Reactive REST Client is not able to handle attributes in the interface annotated with @RegisterRestClient anymore. For example, the user might want to statically initialize variables for default methods provided in the interface. This previously worked with Quarkus 2.5.0.Final and earlier versions, but doesn't anymore.

Expected behavior

The REST Client should work even when (static) attributes are present in the interface.

Actual behavior

Any call to the REST client results in the following exception:

2022-01-19 13:12:37,836 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-2) HTTP Request to /test failed, error id: 403e59c7-1090-401b-b7ea-a86967eca787-1: java.lang.ClassFormatError: Method <clinit> is not static in class file com/example/SomeApi$$CDIWrapper
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:445)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:405)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:445)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:405)
	at com.example.SomeApi$$CDIWrapper_Bean.proxy(Unknown Source)
	at com.example.SomeApi$$CDIWrapper_Bean.get(Unknown Source)
	at com.example.SomeApi$$CDIWrapper_Bean.get(Unknown Source)
	at com.example.TestResource_Bean.create(Unknown Source)
	at com.example.TestResource_Bean.create(Unknown Source)
	...

How to Reproduce?

Reproducer: https://github.com/markusdlugi/rest-client-attributes

Steps to reproduce the behavior:

  1. Start application and send request GET http://localhost:8080/test
  2. Observe failure in application logs
  3. Remove line 26 in com.example.SomeApi and re-test
  4. Observe that REST call is performed correctly

Output of uname -a or ver

Microsoft Windows [Version 10.0.19042.631]

Output of java -version

OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)

GraalVM version (if different from Java)

N/A

Quarkus version or git rev

2.6.2.Final (regression started in 2.5.1.Final)

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

Apache Maven 3.6.3

Additional information

No response

@markusdlugi markusdlugi added the kind/bug Something isn't working label Jan 19, 2022
@quarkus-bot quarkus-bot bot added area/rest-client env/windows Impacts Windows machines labels Jan 19, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jan 19, 2022

/cc @michalszynkiewicz

@geoand
Copy link
Contributor

geoand commented Jan 19, 2022

This has actually already been fixed in main

@geoand geoand closed this as completed Jan 19, 2022
@geoand geoand added this to the 2.7.0.CR1 milestone Jan 19, 2022
@gsmet
Copy link
Member

gsmet commented Jan 19, 2022

@geoand can the fix be backported? Maybe it already is?

@geoand
Copy link
Contributor

geoand commented Jan 19, 2022

You mean backported to 2.7 or 2.6?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest-client env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants