Jump to content

Java ServiceLoader environment not finding services when running in Forge


MatrixShadow

Recommended Posts

Hello,

I am working on a programming mod in Minecraft that is designed for coding Java, and I am using JShell to evaluate the statements. The issue happens when instantiating JShell with:

JShell.builder().build();

With the stack trace:

Caused by: java.lang.IllegalStateException: Launching JShell execution engine threw: No ExecutionControlProvider with name 'failover' and parameter keys: [0, 1, 2]
	at jdk.jshell.JShell.<init>(JShell.java:139) ~[jdk.jshell:?] {}
	at jdk.jshell.JShell$Builder.build(JShell.java:405) ~[jdk.jshell:?] {}
      ..
      ..

This is caused by the ServiceLoader not finding any ExecutionControlProviders. After looking into what a ServiceLoader is (https://www.logicbig.com/tutorials/core-java-tutorial/java-se-api/service-loader.html) and coming across this StackOverflow: (https://stackoverflow.com/questions/71023598/serviceloader-not-finding-any-services) I'm lead to believe that Forge or something to do with the minecraft development environment is not loading the same things as a default java environment (where I've done my testing this far)

(Below is the service loader screenshot, the IllegalArgumentException is thrown since there are no ExecutionControlProviders returned from the ServiceLoader.load(ExecutionControlProvider.class))

jshell-trace-source.png

 

I have tried an alternate way to load a class with 

ServiceLoader.load(ExecutionControlProvider.class, LaunchClassLoaderUtil.class.getClassLoader())
// also tried disabling my mixin annotation processor in build.gradle
//     annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

I'm not super familiar with how all this stuff is set up, and was wondering if anyone had any ideas or suggestions on how to get this working?

 

I've looked through a Minecraft JShell Plugin: (https://github.com/bramhaag/JShell/blob/cc2b8ae1191ab2e1b947a122430c586ed1c5ee81/src/main/java/me/bramhaag/jshell/JShellWrapper.java#L246 and https://www.spigotmc.org/resources/jshell.47753/) but there doesn't seem to be any special configuration there

 

Thanks for taking the time to read! Hopefully we can figure something out...

Link to comment
Share on other sites

  • 11 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.