tritonmc/plugin-core

Dependencies conflict on BungeeCord

Closed this issue · 1 comments

Server: Bungee
Triton Version: 3.0.0-beta.1

Error

17:35:51 [WARNING] Exception encountered when loading plugin: Triton
java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of net/md_5/bungee/api/plugin/PluginClassloader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of net/md_5/bungee/api/plugin/PluginClassloader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:418)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
    at com.zaxxer.hikari.HikariConfig.<clinit>(HikariConfig.java:51)
    at com.rexcantor64.triton.storage.MysqlStorage.<init>(MysqlStorage.java:38)
    at com.rexcantor64.triton.Triton.setupStorage(Triton.java:127)
    at com.rexcantor64.triton.Triton.reload(Triton.java:87)
    at com.rexcantor64.triton.BungeeMLP.reload(BungeeMLP.java:83)
    at com.rexcantor64.triton.Triton.onEnable(Triton.java:76)
    at com.rexcantor64.triton.BungeeMLP.onEnable(BungeeMLP.java:42)
    at com.rexcantor64.triton.plugin.BungeePlugin.onEnable(BungeePlugin.java:16)
    at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:250)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:286)
    at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62)
    at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)

Description

Happens when another plugin is using the same libraries as Triton but on a different version. In this case, it's BotBank.

Solutions

One way to fix this is to shade the dependencies under another package (such as com.rexcantor64.triton).

Additional Information

Reported by @twarix

Shaded org.slf4j into com.rexcantor64.shaded.slf4k