-
Notifications
You must be signed in to change notification settings - Fork 73
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
[BUG] SQL drivers are not relocated when using DatabaseLibrary#connectToORM #113
Comments
Error logs already inacessible, please use pastebin and |
Pardon me. The error logs are irrelevant, because the bug is a matter of contract observation. Anyway, here are your error logs: https://pastebin.com/n05Y1P8F |
and this error doesn't appears without limboauth? |
No, it doesn't. |
Я столкнулся с этой же проблемой: LibertyBans сыпет ошибками, если загрузить limboAuth. Без LimboAuth ни единой ошибки. |
Beginning from new 2.0.0 version this issue should be fixed, please wait untill it will be released |
Describe the bug
LimboAuth relocates most of the libraries it uses (see build.gradle). However, JDBC drivers in the DatabaseLibrary enum are not relocated when they are downloaded. The driver classes should be remapped to the proper namespace, but they are not, which causes conflicts with other plugins.
This matters because the
DatabaseLibrary#connectToORM
method, used by LimboAuth, loads the dependency by attaching it to the plugin classloader. As a result, the driver classes become visible to other plugins. (This is a problem for the same reason that forgetting to relocate dependencies in thebuild.gradle
is a problem)Note that the
DatabaseLibrary#connect
method is okay, because it loads the driver in an isolated classloader. Using an isolated classloader is an accepted practice for loading an unrelocated dependency. However, LimboAuth doesn't use theconnect
method anymore; it usesconnectToORM
.To Reproduce
You can observe conflicts between LimboAuth and other plugins which use the MariaDB driver. For example, LibertyBans is a plugin which uses an isolated classloader for its own copy of the MariaDB driver. This leads to classloading violations in LibertyBans because some of the MariaDB classes are mixed up with the (same) classes loaded by LimboAuth. Because the same classes are loaded by two separate classloaders, classloading errors result.
Steps to reproduce the behavior:
See error: https://hastebin.bluetree242.dev/xeciqimeve.less
Expected behavior
LimboAuth relocates all of its dependencies which are not placed into an isolated classloader.
Screenshots
https://hastebin.bluetree242.dev/xeciqimeve.less
Server Info (please complete the following information):
Additional context
You have a few options to solve the problem. You could relocate dependencies at runtime: other plugins use libraries to do this (however, if you use lucko's jar-relocator, make sure to depend on the latest version, because prior versions have bugs).
Another option would be to find a way to configure your ORM to use the isolated classloader. Then you could continue to use the
connect
method with an isolated classloader. For example, some libraries make use of the thread context classloader which instructs the ORM where to search for the driver. You'll have to consult your ORM documentation on this.The text was updated successfully, but these errors were encountered: