From 06c8210a3a18789c2441ca5f3e7a93ec8cf8a967 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Tue, 6 Sep 2022 22:00:53 +0530 Subject: [PATCH] fix: Fix LinkageError with macOS DNSResolver class (#16581) On macOS, when running a MySQL query, we see the following error: ``` java.lang.ClassCastException: class io.netty.channel.kqueue.KQueueEventLoopGroup cannot be cast to class io.netty.channel.EventLoopGroup ``` This is because of a `LinkageError`, caused because these classes exist both in the parent `server` module classpath, as well as in this plugin's classpath separately. To fix this, we removed this dependency from the server module. But then, this caused a problem with how the `DNSResolver` class was being, well, resolved by the application class loader, vs the plugin class loader. This is a macOS specific problem, and doesn't affect other operating systems. For this, we add just this package as a dependency to the MySQL plugin. --- app/server/appsmith-interfaces/pom.xml | 4 ++++ app/server/appsmith-plugins/mysqlPlugin/pom.xml | 16 ++++++++++++++++ app/server/appsmith-server/pom.xml | 8 -------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/server/appsmith-interfaces/pom.xml b/app/server/appsmith-interfaces/pom.xml index e1f3e596bf..7c22a35440 100644 --- a/app/server/appsmith-interfaces/pom.xml +++ b/app/server/appsmith-interfaces/pom.xml @@ -140,6 +140,10 @@ io.projectreactor reactor-core + + io.netty + netty-resolver-dns-native-macos + diff --git a/app/server/appsmith-plugins/mysqlPlugin/pom.xml b/app/server/appsmith-plugins/mysqlPlugin/pom.xml index 9fe613c5e7..a7e2f29c50 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/pom.xml +++ b/app/server/appsmith-plugins/mysqlPlugin/pom.xml @@ -73,6 +73,22 @@ + + io.netty + netty-resolver-dns-native-macos + runtime + osx-x86_64 + 4.1.75.Final + + + + io.netty + netty-resolver-dns-native-macos + runtime + osx-aarch_64 + 4.1.75.Final + + mysql diff --git a/app/server/appsmith-server/pom.xml b/app/server/appsmith-server/pom.xml index 6c814bfccf..d833c101e5 100644 --- a/app/server/appsmith-server/pom.xml +++ b/app/server/appsmith-server/pom.xml @@ -264,14 +264,6 @@ ff4j-config-yaml ${ff4j.version} - - - io.netty - netty-all - runtime - com.appsmith reactiveCaching