You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am integrating this library into a Minecraft Bukkit plugin and it seems like TransportBuilder is unable to find any transport providers despite the fact that two of them are listed in the service definitions inside the jar.
After some investigation, it looks like plugin class loader instance is needed for ServiceLoader to correctly find provider classes...
@Override
public void onEnable() {
ServiceLoader<ITransportProvider> spiLoader = ServiceLoader.load(ITransportProvider.class);
}
Currently field TransportBuilder#PROVIDERS is to be initialized with static life time. This leaves no way to properly initialize this field from a bukkit plugin even with reflection as attempting to reflect-assign this field causes lazy initialization and thus invoke getTransportProvider() (which will call ServiceLoader without a correct class loader).
The text was updated successfully, but these errors were encountered:
I changed the TransportBuilder like you suggested and also adjusted AbstractTransport (so loading of IMessageReader/Writer will also work in your case).
I am integrating this library into a Minecraft Bukkit plugin and it seems like
TransportBuilder
is unable to find any transport providers despite the fact that two of them are listed in the service definitions inside the jar.After some investigation, it looks like plugin class loader instance is needed for
ServiceLoader
to correctly find provider classes...This works:
This doesn't:
Currently field
TransportBuilder#PROVIDERS
is to be initialized with static life time. This leaves no way to properly initialize this field from a bukkit plugin even with reflection as attempting to reflect-assign this field causes lazy initialization and thus invokegetTransportProvider()
(which will call ServiceLoader without a correct class loader).The text was updated successfully, but these errors were encountered: