SpigotMC / BungeeCord

BungeeCord, the 6th in a generation of server portal suites. Efficiently proxies and maintains connections and transport between multiple Minecraft servers.
https://www.spigotmc.org/go/bungeecord
Other
1.58k stars 1.11k forks source link

Allow loading classes from depending plugin (or how to?) #3139

Open Luluno01 opened 3 years ago

Luluno01 commented 3 years ago

Hi, I am wondering how I can achieve the following:

What I have

What actually happens

Case 1: bundle Kotlin runtime with the third party plugin.

Result: loader constraint violation because the first party and the third party plugin have different instance of the same Kotlin runtime class Continuation.

Case 2: don't bundle Kotlin runtime with the third party plugin.

Result: ClassNotFoundException when loading the third party plugin because its class loader does not load Kotlin runtime from its depending plugin, i.e., the first plugin.


I still can't figure out why this happens only when loading Kotlin runtime classes while loading other classes defined by the depending plugin does not have such problem.

Janmm14 commented 3 years ago

Do you relocate kotlin runtime?

md-5 commented 3 years ago

https://hub.spigotmc.org/jira/browse/SPIGOT-6486

and:

https://www.spigotmc.org/threads/spigot-bungeecord-1-17.510208/

'Please note that for the time being you should not re-declare libraries which are also declared by your dependencies. This might change at a future date, though note that dependency resolution is an extraordinarily complicated topic full of compromises and pitfalls.'

Luluno01 commented 3 years ago

Do you relocate kotlin runtime?

I tried bundling and relocating Kotlin runtime in the third party plugin, which caused MethodNotFoundException. The reason is obvious because it changed to signature of the APIs exposed by the first plugin in the view of the third party plugin. More specifically, the first plugin exposes plugin.foo(kotlin.coroutines.Continuation) while the third party plugin expects plugin.foo(shaded.kotlin.coroutines.Continuation).

Luluno01 commented 3 years ago

https://hub.spigotmc.org/jira/browse/SPIGOT-6486

and:

https://www.spigotmc.org/threads/spigot-bungeecord-1-17.510208/

'Please note that for the time being you should not re-declare libraries which are also declared by your dependencies. This might change at a future date, though note that dependency resolution is an extraordinarily complicated topic full of compromises and pitfalls.'

Thanks! I am looking into it.

Luluno01 commented 3 years ago

https://hub.spigotmc.org/jira/browse/SPIGOT-6486

and:

https://www.spigotmc.org/threads/spigot-bungeecord-1-17.510208/

'Please note that for the time being you should not re-declare libraries which are also declared by your dependencies. This might change at a future date, though note that dependency resolution is an extraordinarily complicated topic full of compromises and pitfalls.'

Hi, I exclude Kotlin runtime (and other Maven dependencies) from both plugin jars and BungeeCord downloads the same Kotlin runtime twice (as I can tell from the server log), once for the first plugin and once for the third party plugin. Here are their plugin.ymls for your reference:

The first party plugin (API provider):

name: BungeeSafeguard
main: cyou.untitled.bungeesafeguard.BungeeSafeguardImpl
version: "3.0"
author: Untitled
libraries:
  - org.jetbrains.kotlin:kotlin-stdlib:1.5.20
  - org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0
  - com.google.code.gson:gson:2.8.7
  - io.ktor:ktor-client-core:1.6.0
  - io.ktor:ktor-client-cio:1.6.0

The third party plugin (API consumer):

name: RESTful-BSG
main: cyou.untitled.restfulbsg.RESTfulBSG
depend:
  - BungeeSafeguard
version: 1.0
author: Untitled
libraries:
  - io.ktor:ktor-server-core:1.6.0
  - io.ktor:ktor-server-netty:1.6.0
  - ch.qos.logback:logback-classic:1.2.3

I noted I shouldn't re-declare the dependencies so I didn't declare Kotlin runtime. Also, I have declared the plugin dependency.

And here is the server log:

[18:06:35 INFO]: [RESTful-BSG] Loading 3 libraries... please wait
[18:06:36 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-server-core/1.6.0/ktor-server-core-1.6.0.pom
[18:06:37 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.5.10/kotlin-stdlib-1.5.10.pom
[18:06:38 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/annotations/13.0/annotations-13.0.pom
[18:06:39 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-common/1.5.10/kotlin-stdlib-common-1.5.10.pom
[18:06:40 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.5.10/kotlin-stdlib-jdk7-1.5.10.pom
[18:06:41 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.5.10/kotlin-stdlib-jdk8-1.5.10.pom
[18:06:42 INFO]: Downloading https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.pom
[18:06:43 INFO]: Downloading https://repo.maven.apache.org/maven2/org/slf4j/slf4j-parent/1.7.30/slf4j-parent-1.7.30.pom
[18:06:44 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.5.0-native-mt/kotlinx-coroutines-jdk8-1.5.0-native-mt.pom
[18:06:45 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.5.0-native-mt/kotlinx-coroutines-core-jvm-1.5.0-native-mt.pom
[18:06:46 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-common/1.5.0/kotlin-stdlib-common-1.5.0.pom
[18:06:47 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-utils-jvm/1.6.0/ktor-utils-jvm-1.6.0.pom
[18:06:48 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.5.0/kotlin-stdlib-jdk8-1.5.0.pom
[18:06:49 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.5.0/kotlin-stdlib-1.5.0.pom
[18:06:50 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.5.0/kotlin-stdlib-jdk7-1.5.0.pom
[18:06:51 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-io-jvm/1.6.0/ktor-io-jvm-1.6.0.pom
[18:06:51 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-http-jvm/1.6.0/ktor-http-jvm-1.6.0.pom
[18:06:52 INFO]: Downloading https://repo.maven.apache.org/maven2/com/typesafe/config/1.3.1/config-1.3.1.pom
[18:06:53 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.5.10/kotlin-reflect-1.5.10.pom
[18:06:54 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-server-netty/1.6.0/ktor-server-netty-1.6.0.pom
[18:06:55 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-server-host-common/1.6.0/ktor-server-host-common-1.6.0.pom
[18:06:56 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-http-cio-jvm/1.6.0/ktor-http-cio-jvm-1.6.0.pom
[18:06:57 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-network-jvm/1.6.0/ktor-network-jvm-1.6.0.pom
[18:06:58 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-codec-http2/4.1.63.Final/netty-codec-http2-4.1.63.Final.pom
[18:06:59 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-parent/4.1.63.Final/netty-parent-4.1.63.Final.pom
[18:07:00 INFO]: Downloading https://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
[18:07:01 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-common/4.1.63.Final/netty-common-4.1.63.Final.pom
[18:07:02 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-buffer/4.1.63.Final/netty-buffer-4.1.63.Final.pom
[18:07:03 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-transport/4.1.63.Final/netty-transport-4.1.63.Final.pom
[18:07:04 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-resolver/4.1.63.Final/netty-resolver-4.1.63.Final.pom
[18:07:05 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-codec/4.1.63.Final/netty-codec-4.1.63.Final.pom
[18:07:05 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-handler/4.1.63.Final/netty-handler-4.1.63.Final.pom
[18:07:06 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-codec-http/4.1.63.Final/netty-codec-http-4.1.63.Final.pom
[18:07:07 INFO]: Downloading https://repo.maven.apache.org/maven2/org/eclipse/jetty/alpn/alpn-api/1.1.3.v20160715/alpn-api-1.1.3.v20160715.pom
[18:07:08 INFO]: Downloading https://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-parent/21/jetty-parent-21.pom
[18:07:09 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-transport-native-kqueue/4.1.63.Final/netty-transport-native-kqueue-4.1.63.Final.pom
[18:07:10 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-transport-native-unix-common/4.1.63.Final/netty-transport-native-unix-common-4.1.63.Final.pom
[18:07:11 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-transport-native-epoll/4.1.63.Final/netty-transport-native-epoll-4.1.63.Final.pom
[18:07:12 INFO]: Downloading https://repo.maven.apache.org/maven2/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.pom
[18:07:13 INFO]: Downloading https://repo.maven.apache.org/maven2/ch/qos/logback/logback-parent/1.2.3/logback-parent-1.2.3.pom
[18:07:14 INFO]: Downloading https://repo.maven.apache.org/maven2/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.pom
[18:07:15 INFO]: Downloading https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom
[18:07:16 INFO]: Downloading https://repo.maven.apache.org/maven2/org/slf4j/slf4j-parent/1.7.25/slf4j-parent-1.7.25.pom
[18:07:16 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-server-core/1.6.0/ktor-server-core-1.6.0.jar
[18:07:16 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-common/1.5.10/kotlin-stdlib-common-1.5.10.jar
[18:07:16 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/annotations/13.0/annotations-13.0.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.5.10/kotlin-stdlib-jdk7-1.5.10.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.5.10/kotlin-stdlib-1.5.10.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.5.10/kotlin-stdlib-jdk8-1.5.10.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.5.0-native-mt/kotlinx-coroutines-jdk8-1.5.0-native-mt.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.5.0-native-mt/kotlinx-coroutines-core-jvm-1.5.0-native-mt.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-utils-jvm/1.6.0/ktor-utils-jvm-1.6.0.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-io-jvm/1.6.0/ktor-io-jvm-1.6.0.jar
[18:07:17 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-http-jvm/1.6.0/ktor-http-jvm-1.6.0.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/com/typesafe/config/1.3.1/config-1.3.1.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.5.10/kotlin-reflect-1.5.10.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-server-netty/1.6.0/ktor-server-netty-1.6.0.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-http-cio-jvm/1.6.0/ktor-http-cio-jvm-1.6.0.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-server-host-common/1.6.0/ktor-server-host-common-1.6.0.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-network-jvm/1.6.0/ktor-network-jvm-1.6.0.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-codec-http2/4.1.63.Final/netty-codec-http2-4.1.63.Final.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-common/4.1.63.Final/netty-common-4.1.63.Final.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-transport/4.1.63.Final/netty-transport-4.1.63.Final.jar
[18:07:18 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-buffer/4.1.63.Final/netty-buffer-4.1.63.Final.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-resolver/4.1.63.Final/netty-resolver-4.1.63.Final.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-codec/4.1.63.Final/netty-codec-4.1.63.Final.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-handler/4.1.63.Final/netty-handler-4.1.63.Final.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/org/eclipse/jetty/alpn/alpn-api/1.1.3.v20160715/alpn-api-1.1.3.v20160715.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-codec-http/4.1.63.Final/netty-codec-http-4.1.63.Final.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-transport-native-kqueue/4.1.63.Final/netty-transport-native-kqueue-4.1.63.Final.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-transport-native-unix-common/4.1.63.Final/netty-transport-native-unix-common-4.1.63.Final.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/io/netty/netty-transport-native-epoll/4.1.63.Final/netty-transport-native-epoll-4.1.63.Final.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
[18:07:19 INFO]: Downloading https://repo.maven.apache.org/maven2/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-server-core\1.6.0\ktor-server-core-1.6.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib\1.5.10\kotlin-stdlib-1.5.10.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\annotations\13.0\annotations-13.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-common\1.5.10\kotlin-stdlib-common-1.5.10.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.5.10\kotlin-stdlib-jdk7-1.5.10.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.5.10\kotlin-stdlib-jdk8-1.5.10.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\kotlinx-coroutines-jdk8\1.5.0-native-mt\kotlinx-coroutines-jdk8-1.5.0-native-mt.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\kotlinx-coroutines-core-jvm\1.5.0-native-mt\kotlinx-coroutines-core-jvm-1.5.0-native-mt.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-utils-jvm\1.6.0\ktor-utils-jvm-1.6.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-io-jvm\1.6.0\ktor-io-jvm-1.6.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-http-jvm\1.6.0\ktor-http-jvm-1.6.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\com\typesafe\config\1.3.1\config-1.3.1.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-reflect\1.5.10\kotlin-reflect-1.5.10.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-server-netty\1.6.0\ktor-server-netty-1.6.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-server-host-common\1.6.0\ktor-server-host-common-1.6.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-http-cio-jvm\1.6.0\ktor-http-cio-jvm-1.6.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-network-jvm\1.6.0\ktor-network-jvm-1.6.0.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-codec-http2\4.1.63.Final\netty-codec-http2-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-common\4.1.63.Final\netty-common-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-buffer\4.1.63.Final\netty-buffer-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-transport\4.1.63.Final\netty-transport-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-resolver\4.1.63.Final\netty-resolver-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-codec\4.1.63.Final\netty-codec-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-handler\4.1.63.Final\netty-handler-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-codec-http\4.1.63.Final\netty-codec-http-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\eclipse\jetty\alpn\alpn-api\1.1.3.v20160715\alpn-api-1.1.3.v20160715.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-transport-native-kqueue\4.1.63.Final\netty-transport-native-kqueue-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-transport-native-unix-common\4.1.63.Final\netty-transport-native-unix-common-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-transport-native-epoll\4.1.63.Final\netty-transport-native-epoll-4.1.63.Final.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar
[18:07:20 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar
[18:07:20 INFO]: Loaded plugin RESTful-BSG version 1.0 by Untitled
[18:07:20 INFO]: Loaded plugin cmd_send version git:cmd_send:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:07:20 INFO]: Loaded plugin cmd_list version git:cmd_list:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:07:20 INFO]: [BungeeSafeguard] Loading 5 libraries... please wait
[18:07:20 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.5.20/kotlin-stdlib-1.5.20.pom
[18:07:21 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-common/1.5.20/kotlin-stdlib-common-1.5.20.pom
[18:07:22 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.5.0/kotlinx-coroutines-core-1.5.0.pom
[18:07:23 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.5.0/kotlinx-coroutines-core-jvm-1.5.0.pom
[18:07:24 INFO]: Downloading https://repo.maven.apache.org/maven2/com/google/code/gson/gson/2.8.7/gson-2.8.7.pom
[18:07:25 INFO]: Downloading https://repo.maven.apache.org/maven2/com/google/code/gson/gson-parent/2.8.7/gson-parent-2.8.7.pom
[18:07:26 INFO]: Downloading https://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom
[18:07:27 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-client-core/1.6.0/ktor-client-core-1.6.0.pom
[18:07:28 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.5.0-native-mt/kotlinx-coroutines-core-1.5.0-native-mt.pom
[18:07:29 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-http/1.6.0/ktor-http-1.6.0.pom
[18:07:30 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-utils/1.6.0/ktor-utils-1.6.0.pom
[18:07:30 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-io/1.6.0/ktor-io-1.6.0.pom
[18:07:31 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/atomicfu/0.16.1/atomicfu-0.16.1.pom
[18:07:32 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/atomicfu-jvm/0.16.1/atomicfu-jvm-0.16.1.pom
[18:07:33 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-http-cio/1.6.0/ktor-http-cio-1.6.0.pom
[18:07:34 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-client-cio/1.6.0/ktor-client-cio-1.6.0.pom
[18:07:35 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-network-tls/1.6.0/ktor-network-tls-1.6.0.pom
[18:07:36 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-network/1.6.0/ktor-network-1.6.0.pom
[18:07:37 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-common/1.5.20/kotlin-stdlib-common-1.5.20.jar
[18:07:37 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.5.0/kotlin-stdlib-jdk8-1.5.0.jar
[18:07:37 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.5.0/kotlinx-coroutines-core-jvm-1.5.0.jar
[18:07:37 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.5.20/kotlin-stdlib-1.5.20.jar
[18:07:37 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.5.0/kotlinx-coroutines-core-1.5.0.jar
[18:07:37 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.5.0/kotlin-stdlib-jdk7-1.5.0.jar
[18:07:37 INFO]: Downloading https://repo.maven.apache.org/maven2/com/google/code/gson/gson/2.8.7/gson-2.8.7.jar
[18:07:37 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-http/1.6.0/ktor-http-1.6.0.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-client-core/1.6.0/ktor-client-core-1.6.0.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-utils/1.6.0/ktor-utils-1.6.0.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-io/1.6.0/ktor-io-1.6.0.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-http-cio/1.6.0/ktor-http-cio-1.6.0.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/atomicfu/0.16.1/atomicfu-0.16.1.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/atomicfu-jvm/0.16.1/atomicfu-jvm-0.16.1.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-client-cio/1.6.0/ktor-client-cio-1.6.0.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-network/1.6.0/ktor-network-1.6.0.jar
[18:07:38 INFO]: Downloading https://repo.maven.apache.org/maven2/io/ktor/ktor-network-tls/1.6.0/ktor-network-tls-1.6.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib\1.5.20\kotlin-stdlib-1.5.20.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\annotations\13.0\annotations-13.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-common\1.5.20\kotlin-stdlib-common-1.5.20.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\kotlinx-coroutines-core\1.5.0\kotlinx-coroutines-core-1.5.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\kotlinx-coroutines-core-jvm\1.5.0\kotlinx-coroutines-core-jvm-1.5.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.5.0\kotlin-stdlib-jdk8-1.5.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.5.0\kotlin-stdlib-jdk7-1.5.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\com\google\code\gson\gson\2.8.7\gson-2.8.7.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-client-core\1.6.0\ktor-client-core-1.6.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-http\1.6.0\ktor-http-1.6.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-utils\1.6.0\ktor-utils-1.6.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-io\1.6.0\ktor-io-1.6.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-http-cio\1.6.0\ktor-http-cio-1.6.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\atomicfu\0.16.1\atomicfu-0.16.1.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\atomicfu-jvm\0.16.1\atomicfu-jvm-0.16.1.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-client-cio\1.6.0\ktor-client-cio-1.6.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-network-tls\1.6.0\ktor-network-tls-1.6.0.jar
[18:07:38 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-network\1.6.0\ktor-network-1.6.0.jar
[18:07:39 INFO]: Loaded plugin BungeeSafeguard version 3.0 by Untitled
[18:07:39 WARN]: Forced host server pvp is not defined
[18:07:39 INFO]: Enabled plugin reconnect_yaml version git:reconnect_yaml:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:07:39 INFO]: Enabled plugin cmd_find version git:cmd_find:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:07:39 INFO]: Enabled plugin cmd_server version git:cmd_server:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:07:39 INFO]: Enabled plugin cmd_alert version git:cmd_alert:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:07:39 INFO]: Enabled plugin RESTful-BSG version 1.0 by Untitled
[18:07:39 INFO]: Enabled plugin cmd_send version git:cmd_send:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:07:39 INFO]: Enabled plugin cmd_list version git:cmd_list:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:07:39 INFO]: Enabled plugin BungeeSafeguard version 3.0 by Untitled

After trying to access the API from the third party plugin:

java.lang.LinkageError: loader constraint violation: when resolving interface method 'java.lang.Object cyou.untitled.bungeesafeguard.list.UUIDList.get(kotlin.coroutines.Continuation)' the class loader net.md_5.bungee.api.plugin.PluginClassloader @31ddb930 of the current class, cyou/untitled/restfulbsg/Server$start$2$1, and the class loader net.md_5.bungee.api.plugin.PluginClassloader @4c86da0c for the method's defining class, cyou/untitled/bungeesafeguard/list/UUIDList, have different Class objects for the type kotlin/coroutines/Continuation used in the signature (cyou.untitled.restfulbsg.Server$start$2$1 is in unnamed module of loader net.md_5.bungee.api.plugin.PluginClassloader @31ddb930, parent loader 'app'; cyou.untitled.bungeesafeguard.list.UUIDList is in unnamed module of loader net.md_5.bungee.api.plugin.PluginClassloader @4c86da0c, parent loader 'app')
        at cyou.untitled.restfulbsg.Server$start$2$1.invoke$toJSON-0(Server.kt:51) ~[?:?]
        at cyou.untitled.restfulbsg.Server$start$2$1.access$invoke$toJSON-0(Server.kt:38) ~[?:?]
        at cyou.untitled.restfulbsg.Server$start$2$1$1$2.invokeSuspend(Server.kt:56) ~[?:?]
        at cyou.untitled.restfulbsg.Server$start$2$1$1$2.invoke(Server.kt) ~[?:?]
        at cyou.untitled.restfulbsg.Server$start$2$1$1$2.invoke(Server.kt) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) ~[?:?]
        at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79) ~[?:?]
        at io.ktor.routing.Routing.executeResult(Routing.kt:155) ~[?:?]
        at io.ktor.routing.Routing.interceptor(Routing.kt:39) ~[?:?]
        at io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:107) ~[?:?]
        at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) ~[?:?]
        at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) ~[?:?]
        at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79) ~[?:?]
        at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:124) ~[?:?]
        at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) ~[?:?]        at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) ~[?:?]        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) ~[?:?]
        at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:123) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt) ~[?:?]
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55) ~[?:?]
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.startCoroutineImpl(Builders.common.kt:194) ~[?:?]
        at kotlinx.coroutines.BuildersKt.startCoroutineImpl(Unknown Source) ~[?:?]
        at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:134) ~[?:?]
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) ~[?:?]
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:43) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:34) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:370) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda-1$lambda-0(NettyApplicationEngine.kt:251) ~[?:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at java.lang.Thread.run(Thread.java:832) [?:?]

It seems the class loaders of two plugins loaded their own instance of Kotlin runtime from the same underlying jar file.

BTW it is weird to me that the dependent plugin gets enabled before its depending plugin. Am I doing anything wrong here?

Luluno01 commented 3 years ago

Oh wait let me check the first link...

Janmm14 commented 3 years ago

Declaring plugin dependencies in bungeecord is done with depends and not with depend. This will fix all your problems. Make sure you remove libraries defined in BungeeSafeguard from RESTful-BSG.

Luluno01 commented 3 years ago

Declaring plugin dependencies in bungeecord is done with depends and not with depend. This will fix all your problems.

Thanks! IDEA did not warn me about it at all... Now the third party plugin loads after the first but the loader constraint violation is still there. I am looking at https://hub.spigotmc.org/jira/browse/SPIGOT-6486 as it looks like exactly the same problem as mine.

Luluno01 commented 3 years ago

Declaring plugin dependencies in bungeecord is done with depends and not with depend. This will fix all your problems.

Thanks! IDEA did not warn me about it at all... Now the third party plugin loads after the first but the loader constraint violation is still there. I am looking at https://hub.spigotmc.org/jira/browse/SPIGOT-6486 as it looks like exactly the same problem as mine.

Nope. The "declaring libraries in A only" solution is exactly what I am doing - and the loader constraint violation remains unresolved.

Luluno01 commented 3 years ago

Okay here is the updated plugin.ymls and server log.

The first party plugin (API provider):

name: BungeeSafeguard
main: cyou.untitled.bungeesafeguard.BungeeSafeguardImpl
version: "3.0"
author: Untitled
libraries:
  - org.jetbrains.kotlin:kotlin-stdlib:1.5.20
  - org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0
  - com.google.code.gson:gson:2.8.7
  - io.ktor:ktor-client-core:1.6.0
  - io.ktor:ktor-client-cio:1.6.0

The third party plugin (API consumer):

name: RESTful-BSG
main: cyou.untitled.restfulbsg.RESTfulBSG
depends:
  - BungeeSafeguard
version: 1.0
author: Untitled
libraries:
  - io.ktor:ktor-server-core:1.6.0
  - io.ktor:ktor-server-netty:1.6.0
  - ch.qos.logback:logback-classic:1.2.3

Server log:

[18:33:42 INFO]: [BungeeSafeguard] Loading 5 libraries... please wait
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib\1.5.20\kotlin-stdlib-1.5.20.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\annotations\13.0\annotations-13.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-common\1.5.20\kotlin-stdlib-common-1.5.20.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\kotlinx-coroutines-core\1.5.0\kotlinx-coroutines-core-1.5.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\kotlinx-coroutines-core-jvm\1.5.0\kotlinx-coroutines-core-jvm-1.5.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.5.0\kotlin-stdlib-jdk8-1.5.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.5.0\kotlin-stdlib-jdk7-1.5.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\com\google\code\gson\gson\2.8.7\gson-2.8.7.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-client-core\1.6.0\ktor-client-core-1.6.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-http\1.6.0\ktor-http-1.6.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-utils\1.6.0\ktor-utils-1.6.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-io\1.6.0\ktor-io-1.6.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-http-cio\1.6.0\ktor-http-cio-1.6.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\atomicfu\0.16.1\atomicfu-0.16.1.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\atomicfu-jvm\0.16.1\atomicfu-jvm-0.16.1.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-client-cio\1.6.0\ktor-client-cio-1.6.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-network-tls\1.6.0\ktor-network-tls-1.6.0.jar
[18:33:42 INFO]: [BungeeSafeguard] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-network\1.6.0\ktor-network-1.6.0.jar
[18:33:42 INFO]: Loaded plugin BungeeSafeguard version 3.0 by Untitled
[18:33:42 INFO]: [RESTful-BSG] Loading 3 libraries... please wait
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-server-core\1.6.0\ktor-server-core-1.6.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib\1.5.10\kotlin-stdlib-1.5.10.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\annotations\13.0\annotations-13.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-common\1.5.10\kotlin-stdlib-common-1.5.10.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.5.10\kotlin-stdlib-jdk7-1.5.10.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.5.10\kotlin-stdlib-jdk8-1.5.10.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\kotlinx-coroutines-jdk8\1.5.0-native-mt\kotlinx-coroutines-jdk8-1.5.0-native-mt.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlinx\kotlinx-coroutines-core-jvm\1.5.0-native-mt\kotlinx-coroutines-core-jvm-1.5.0-native-mt.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-utils-jvm\1.6.0\ktor-utils-jvm-1.6.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-io-jvm\1.6.0\ktor-io-jvm-1.6.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-http-jvm\1.6.0\ktor-http-jvm-1.6.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\com\typesafe\config\1.3.1\config-1.3.1.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\jetbrains\kotlin\kotlin-reflect\1.5.10\kotlin-reflect-1.5.10.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-server-netty\1.6.0\ktor-server-netty-1.6.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-server-host-common\1.6.0\ktor-server-host-common-1.6.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-http-cio-jvm\1.6.0\ktor-http-cio-jvm-1.6.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\ktor\ktor-network-jvm\1.6.0\ktor-network-jvm-1.6.0.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-codec-http2\4.1.63.Final\netty-codec-http2-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-common\4.1.63.Final\netty-common-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-buffer\4.1.63.Final\netty-buffer-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-transport\4.1.63.Final\netty-transport-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-resolver\4.1.63.Final\netty-resolver-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-codec\4.1.63.Final\netty-codec-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-handler\4.1.63.Final\netty-handler-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-codec-http\4.1.63.Final\netty-codec-http-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\org\eclipse\jetty\alpn\alpn-api\1.1.3.v20160715\alpn-api-1.1.3.v20160715.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-transport-native-kqueue\4.1.63.Final\netty-transport-native-kqueue-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-transport-native-unix-common\4.1.63.Final\netty-transport-native-unix-common-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\io\netty\netty-transport-native-epoll\4.1.63.Final\netty-transport-native-epoll-4.1.63.Final.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar
[18:33:42 INFO]: [RESTful-BSG] Loaded library E:\Program Files\bungee\libraries\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar
[18:33:42 INFO]: Loaded plugin RESTful-BSG version 1.0 by Untitled
[18:33:42 INFO]: Loaded plugin cmd_send version git:cmd_send:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:33:42 INFO]: Loaded plugin cmd_list version git:cmd_list:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:33:42 WARN]: Forced host server pvp is not defined
[18:33:42 INFO]: Enabled plugin reconnect_yaml version git:reconnect_yaml:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:33:42 INFO]: Enabled plugin cmd_find version git:cmd_find:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:33:42 INFO]: Enabled plugin cmd_server version git:cmd_server:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:33:42 INFO]: Enabled plugin cmd_alert version git:cmd_alert:1.17-R0.1-SNAPSHOT:436f47f:437 by WaterfallMC
[18:33:42 INFO]: Enabled plugin BungeeSafeguard version 3.0 by Untitled
[18:33:42 INFO]: Enabled plugin RESTful-BSG version 1.0 by Untitled
java.lang.LinkageError: loader constraint violation: when resolving interface method 'java.lang.Object cyou.untitled.bungeesafeguard.list.UUIDList.get(kotlin.coroutines.Continuation)' the class loader net.md_5.bungee.api.plugin.PluginClassloader @3be4f71 of the current class, cyou/untitled/restfulbsg/Server$start$2$1, and the class loader net.md_5.bungee.api.plugin.PluginClassloader @6b63d445 for the method's defining class, cyou/untitled/bungeesafeguard/list/UUIDList, have different Class objects for the type kotlin/coroutines/Continuation used in the signature (cyou.untitled.restfulbsg.Server$start$2$1 is in unnamed module of loader net.md_5.bungee.api.plugin.PluginClassloader @3be4f71, parent loader 'app'; cyou.untitled.bungeesafeguard.list.UUIDList is in unnamed module of loader net.md_5.bungee.api.plugin.PluginClassloader @6b63d445, parent loader 'app')
        at cyou.untitled.restfulbsg.Server$start$2$1.invoke$toJSON-0(Server.kt:51) ~[?:?]
        at cyou.untitled.restfulbsg.Server$start$2$1.access$invoke$toJSON-0(Server.kt:38) ~[?:?]
        at cyou.untitled.restfulbsg.Server$start$2$1$1$2.invokeSuspend(Server.kt:56) ~[?:?]
        at cyou.untitled.restfulbsg.Server$start$2$1$1$2.invoke(Server.kt) ~[?:?]
        at cyou.untitled.restfulbsg.Server$start$2$1$1$2.invoke(Server.kt) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) ~[?:?]
        at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79) ~[?:?]
        at io.ktor.routing.Routing.executeResult(Routing.kt:155) ~[?:?]
        at io.ktor.routing.Routing.interceptor(Routing.kt:39) ~[?:?]
        at io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:107) ~[?:?]
        at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) ~[?:?]
        at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) ~[?:?]
        at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79) ~[?:?]
        at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:124) ~[?:?]
        at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) ~[?:?]
        at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) ~[?:?]
        at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) ~[?:?]
        at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:79) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:123) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt) ~[?:?]
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55) ~[?:?]
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.startCoroutineImpl(Builders.common.kt:194) ~[?:?]
        at kotlinx.coroutines.BuildersKt.startCoroutineImpl(Unknown Source) ~[?:?]
        at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:134) ~[?:?]
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) ~[?:?]
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:43) ~[?:?]
        at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:34) ~[?:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:370) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda-1$lambda-0(NettyApplicationEngine.kt:251) ~[?:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[waterfall-1.17-437.jar:git:Waterfall-Bootstrap:1.17-R0.1-SNAPSHOT:436f47f:437]
        at java.lang.Thread.run(Thread.java:832) [?:?]
Janmm14 commented 3 years ago

The problem is likely that the library loader also loads transitive dependencies and so RESTful-BSG in the end still got same libraries as the dependant plugin.

This seems to be a bug in bungeecord.

Luluno01 commented 3 years ago

The problem is likely that the library loader also loads transitive dependencies and so RESTful-BSG in the end still got same libraries as the dependant plugin.

This seems to be a bug in bungeecord.

Any suggested workaround? Should I wait for the patch, or do something like declaring all transitive dependencies in the first plugin?

Janmm14 commented 3 years ago

You could move the library statements from the RESTful-BSG to the BungeeSafeguard plugin, this should do the trick.

Luluno01 commented 3 years ago

You could move the library statements from the RESTful-BSG to the BungeeSafeguard plugin, this should do the trick.

Yes, this works. Thanks! Nonetheless I will wait for official fix for this since I can't predict what dependencies the third party plugins would need.

Luluno01 commented 3 years ago

Hi, any plan for fixing the transitive dependency problem? I am looking forward to a graceful fix so that I can release my new plugin update...

I am not sure if you are also considering the version collision problem. In my view a plugin must adapt itself to the plugin it depends on, rather than the other way around. I guess it is quite reasonable to just make the class loader of a plugin a parent loader of all other plugins that depend on it - the child plugin must have known what versions of libraries the parent plugin is using. In case of version collision (which is predictable by the depending plugin), the depending plugin should shade and bundle the corresponding libraries.