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

io.vertx.core.eventbus.EventBus cannot decode List<Long> payload (???) #29436

Closed
syr opened this issue Nov 23, 2022 · 14 comments
Closed

io.vertx.core.eventbus.EventBus cannot decode List<Long> payload (???) #29436

syr opened this issue Nov 23, 2022 · 14 comments
Labels
area/vertx kind/bug Something isn't working

Comments

@syr
Copy link

syr commented Nov 23, 2022

Describe the bug

I do something like

eventBus.send("myBusAddress", List.of(1L,2L));

and having a consumer method like

@ConsumeEvent(BUS_ADDRESS_RETRY)
    public void doAsync(List<Long> longList) {
    ...
    }

Expected behavior

Was hoping this would just work, meaning that in doAsync the longList = [1L,2L]

Actual behavior

Instead I get

2022-11-23 10:00:25,967 ERROR job=[] traceId=[] spanId=[] [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile local): java.lang.ClassNotFoundException: java.util.List<java.lang.Long>
	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:459)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:450)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:459)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:450)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:467)
	at io.quarkus.deployment.steps.VertxProcessor$build609260703.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.VertxProcessor$build609260703.deploy(Unknown Source)
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:69)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:122)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	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:103)
	at java.base/java.lang.Thread.run(Thread.java:833)

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.13.3.Final

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

No response

Additional information

When trying to use latest quarkus version 2.14.1.Final breaks my project build with

cannot find symbol
symbol: class OkHttpClient
package okhttp3 does not exist

Think that's another issue I have to create when I dont get this fixed on my own-

@syr syr added the kind/bug Something isn't working label Nov 23, 2022
@geoand
Copy link
Contributor

geoand commented Nov 25, 2022

cc @mkouba

@mkouba
Copy link
Contributor

mkouba commented Nov 25, 2022

I believe that this problem is fixed with #29446. And I wasn't able to reproduce the issue in the main branch.

The fix targets 2.14.2.Final and should be backported in 2.13 as well.

Unfortunately, I'm not aware of any workaround; maybe just try use a raw type instead of List<Integer> in the consuming method?

@mkouba mkouba closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2022
@mkouba
Copy link
Contributor

mkouba commented Nov 25, 2022

However, I'm not quite sure how does the Vert.x event bus handle generic types in the sense that the type is not considered during delivery of the event and e.g. if you send List<Integer> and the consumer receives List<String> then you may get a ClassCastException...

@cescoffier
Copy link
Member

Yes, the types must match.

@Ladicek
Copy link
Contributor

Ladicek commented Nov 25, 2022

I believe that this problem is fixed with #29446.

Agree, given the error message says java.lang.ClassNotFoundException: java.util.List<java.lang.Long>, which just points to Type.toString() again.

@syr
Copy link
Author

syr commented Nov 26, 2022

I believe that this problem is fixed with #29446. And I wasn't able to reproduce the issue in the main branch.

The fix targets 2.14.2.Final and should be backported in 2.13 as well.

Unfortunately, I'm not aware of any workaround; maybe just try use a raw type instead of List<Integer> in the consuming method?

Can confirm that the issue is fixed with 2.14.2.Final. :)

@geoand
Copy link
Contributor

geoand commented Nov 29, 2022

which just points to Type.toString() again

How about we ban it? This has come to bite us again and again, so I think we should ban it in a some of the core modules, WDYT?
If we do want this, I can open a first PR

@Ladicek
Copy link
Contributor

Ladicek commented Nov 29, 2022

That makes sense to me -- Type.toString() has always been usable only for human-readable string representation.

@mkouba
Copy link
Contributor

mkouba commented Nov 29, 2022

How about we ban it?

How do we do that?

@geoand
Copy link
Contributor

geoand commented Nov 29, 2022

I'll open a PR soon :)

@gsmet
Copy link
Member

gsmet commented Nov 29, 2022

@geoand
Copy link
Contributor

geoand commented Nov 29, 2022

You spoiled the surprise 😆

@geoand
Copy link
Contributor

geoand commented Nov 29, 2022

LOL, see #29551

geoand added a commit to geoand/quarkus that referenced this issue Nov 29, 2022
@mkouba
Copy link
Contributor

mkouba commented Nov 29, 2022

Interesting...

geoand added a commit that referenced this issue Nov 30, 2022
Ban the use of org.jboss.jandex.Type#toString() in core deployment module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vertx kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants