ClassCastException during verticles deployment with Vert.x 4

272 views
Skip to first unread message

tho...@melusyn.com

unread,
Jun 28, 2021, 12:19:39 PM6/28/21
to vert.x
Hi, 

We are currently upgrading our microservices from Vert.x 3.9.x to 4.x and face issues during the deployment.

We have a main verticle responsible for the deployment of the others. It uses a Maven Service Factory: https://vertx.io/docs/vertx-maven-service-factory/java/ 

Since the upgrade to vert.x 4, a ClassCastException is thrown when deploying at least 2 different verticles. This exception occurs when facing any external dependency. 

I have made a reproducer for vert.x 4, here: https://github.com/thomas-melusyn/vertx-examples forking the vertx-examples from the official repo.
Strangely, I was not able to make the tests succeed with vert.x 3.9 (see branch vertx-3.9).

When running the unit test,  this error is thrown: 
java.lang.UnsupportedOperationException
at io.vertx.core.impl.VerticleManager.lambda$deployVerticle$2(VerticleManager.java:166)
at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:128)


With the help of the debug, we can find the underlying exception: 
java.lang.ClassCastException: io.vertx.ext.mongo.impl.MongoClientImpl$MongoHolder cannot be cast to io.vertx.ext.mongo.impl.MongoClientImpl$MongoHolder
Here's the debug console:Screen Shot 2021-06-28 at 17.44.16.png

I've tried a lot of things to understand where this could come from but I haven't found a clue yet. 

Does anyone have faced a similar error? 

How do you deploy multiple verticles at the same time with a parent verticle deploying other ones?


Best 
Thomas

Thomas SEGISMONT

unread,
Jun 29, 2021, 5:28:50 AM6/29/21
to vert.x
Hi,

This ClassClastException happens because the MongoHolder class has been loaded in two different IsolatedClassLoader instances.

Vert.x should not load its classes in IsolatedClassLoader. Can you please file an issue to Vert.x core? Thank you

The information contained in this email is strictly personal, confidential and privileged. This message is intended only for the addressee. If you are not the intended recipient please erase all copies and notify us immediately. Any disclosure, reproduction or use is prohibited and could be unlawful. We decline any responsibility for potential damages caused by a polluted email. You can always unsubscribe from our mailing list, by replying to this message, including unsubscribe in the topic.


--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/4457a622-8f58-421b-aec3-03b14e04fa0an%40googlegroups.com.

Julien Viet

unread,
Jun 29, 2021, 6:08:06 AM6/29/21
to vert.x

tho...@melusyn.com

unread,
Jun 29, 2021, 6:23:39 AM6/29/21
to vert.x
Thank you, 

here's the issue I just created https://github.com/eclipse-vertx/vert.x/issues/3987
I included the link of the GitHub repo with the reproducer
Reply all
Reply to author
Forward
0 new messages