TriggerReactor

TriggerReactor

24.6k Downloads

ScriptEngine not detected in some fork verions

wysohn opened this issue ยท 0 comments

commented

image


This is probably caused by this line:

Thread.currentThread().setContextClassLoader(plugin.getClass().getClassLoader());

The rationale behind this code is that Spigot API has its own classloader so that it can load the plugin .jar files runtime, unlike the traditional way of loading the external .jar files. However, for some reason, classes of Nashorn engine was not detected by the custom classloader of the Spigot API, so this was a temporary fix to enforce the right class loader bind to the spigot main thread.

Probably the fork versions of Spigot API have different ways to load the plugins hence that's 'maybe' why TriggerReactor doesn't recognize the existing ScriptEngine such as graal.js.

The most promising move is removing this line and figure out why the original class loader can't find Nashorn.

Another extra information that might be helpful is that JavaPlugin class has protected method getClassLoader


One user also reported that having TriggerReactor also makes the graal.js not available for other plugins, so this is probably related to setContextClassLoader mentioned above.