MinecraftServerControl / mscs

Powerful command-line control for UNIX and Linux powered Minecraft servers
https://minecraftservercontrol.github.io
BSD 2-Clause "Simplified" License
479 stars 61 forks source link

Facing an error when trying to host snapshot version with mscs #292

Closed Latuchi closed 3 years ago

Latuchi commented 3 years ago

I'm facing "Error starting the server: couldn't retrieve the server's process ID." when I'm trying to host latest snapshot version (21w20a). I've tried doing this with multiple new worlds, always ending up with this error.

First I tried this by only adding mscs-version-type=snapshot to worlds mscs.properties file. Then created a second world and to that worlds mscs.properties file I tried adding mscs-version-type=snapshot with pointers to specific snapshot version with mscs-client-version=21w20a and mscs-server-version=21w20a. After this I edited the mscs.properties file by changing the line with mscs-default-version-type to mscs-default-version-type=snapshot and still facing the same error with a third world.

sandain commented 3 years ago

Did you modify the eula.txt file to have a true value?

Can you post the contents of the console.out file so we can see some more context?

Latuchi commented 3 years ago

Did you modify the eula.txt file to have a true value?

I did modify the eula.txt to have true value.

Can you post the contents of the console.out file so we can see some more context?

For some reason I never thought of checking the console.out file. Maybe there could be use for more verbose output when running into an error.

console.out

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime ($
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

My server is running Debian 10 and sudo apt-get install default-jre returns that I already have the newest version of default-jre package installed

sudo apt-get install default-jre              
Reading package lists... Done
Building dependency tree       
Reading state information... Done
default-jre is already the newest version (2:1.11-71).
0 upgraded, 0 newly installed, 0 to remove and 176 not upgraded.
sandain commented 3 years ago

Hmm. Odd. It works for me on Ubuntu 21.04

sudo apt install default-jre
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
default-jre is already the newest version (2:1.11-72).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
mscs status
Minecraft Server Status:
  alpha: running version 1.16.5 (0 of 20 users online).
    Port: 25566.
    Memory used: 1.33GB (2GB allocated).
    Process ID: 285485.
  beta: running version 21w20a (0 of 20 users online).
    Port: 25568.
    Memory used: 1.68GB (2GB allocated).
    Process ID: 294009.
  lobby: running.
    Memory used: 0.1GB (2GB allocated).
    Process ID: 285766.

Maybe you could try installing 1.11-72 from Bullseye or Sid where the updated version is available? Perhaps 1.11-71 has a bug in it?

sandain commented 3 years ago

You might also have an older incompatible version of java installed and set to default. Check with:

sudo update-alternatives --config java

My default java is actually calling 1.17. So, it may actually be 1.11 that is out of date...

sandain commented 3 years ago

It looks like 21w20a needs a more recent version of Java than 1.11. When I try to run it on 1.11 I get the following error:

Error: LinkageError occurred while loading main class net.minecraft.server.Main
        java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Whereas Java 1.17 works.

Latuchi commented 3 years ago

Thanks! Got it working now. :)

test: running version 21w20a (0 of 20 users online).
    Port: 25565.
    Memory used: 1.68GB (8GB allocated).
    Process ID: 13109.

I installed newer version of Java with sudo apt-get install openjdk-17-jre and after that I ran java -version to check that my server is actually using the newer version of Java. After installing the newer version of Java, modifying the worlds mscs.properties with mscs-version-type=snapshot was enough to get the snapshot world working.

Roflicide commented 3 years ago

Thanks for bringing this to our attention @Latuchi. I've updated the instructions on the Installation page to detail this:

image