ZenUtils icon indicating copy to clipboard operation
ZenUtils copied to clipboard

Dedicated server crashes if started by `java -cp`

Open Srdjan-V opened this issue 1 month ago • 2 comments

Environment

Item Version
ZenUtils 1.28.6; 1.28.9
CraftTweaker 2-1.12-4.1.20.715
Loader Cleanroom 0.6.11-alpha (Foundation 0.19.11)
Java OpenJDK 25.0.5, Linux aarch64
Side Dedicated server
Modpack Enigmatica 2 Expert - Extended (CurseForge file 8997800)

How the server is launched

The server runs in Docker with the itzg/minecraft-server image (java25 tag), started with Docker Compose:

services:
  e2ee:
    image: itzg/minecraft-server:java25
    container_name: e2ee
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
      TYPE: AUTO_CURSEFORGE
      APPLY_CLEANROOM: "true"
      CLEANROOM_LOADER_VERSION: "0.6.11-alpha"
      CF_SLUG: enigmatica-2-expert-extended
      CF_FILE_ID: "8997800"
      MEMORY: 8G
      USE_AIKAR_FLAGS: "true"
      DIFFICULTY: normal
      MOTD: "Enigmatica 2 Expert - Extended"
      ENABLE_AUTOPAUSE: "FALSE"
    volumes:
      - /ssd/docker/minecraft/e2ee:/data

The image installs Cleanroom with the Cleanroom installer. The installer generates run.sh, which starts the server like this:

"$JAVA" @user_jvm_args.txt @libraries/com/cleanroommc/cleanroom/0.6.11-alpha/unix_args.txt "$@"

unix_args.txt passes every library with -cp, separated by ::

-cp
libraries/com/cleanroommc/cleanroom/0.6.11-alpha/cleanroom-0.6.11-alpha.jar:libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:...:libraries/net/minecraft/server/1.12.2/server-1.12.2.jar

Problem

The server does not start. ZenUtils fails in the coremod phase, when it opens the classpath, and Foundation stops the launch. From logs/latest.log:

[11:19:35] [main/INFO] [zenutils-mixin_init]: found craft tweaker jar: ./mods/CraftTweaker2-1.12-4.1.20.715.jar
[11:19:38] [main/INFO] [youyihj.zenutils.impl.util.DeobfMinecraftBytesProvider]: Loading classpath, forge path: libraries/com/cleanroommc/cleanroom/0.6.11-alpha/cleanroom-0.6.11-alpha.jar:libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:...(about 130 entries)...:libraries/net/minecraft/server/1.12.2/server-1.12.2.jar
[11:19:38] [main/FATAL] [Foundation]: Unable to launch
java.lang.ExceptionInInitializerError
	at stanhebben.zenscript.compiler.TypeRegistry.<init>(MixinTypeRegistry.java:40)
	at stanhebben.zenscript.type.ZenTypeIntRange.<init>(ZenTypeIntRange.java:26)
	at stanhebben.zenscript.type.ZenTypeIntRange.<clinit>(ZenTypeIntRange.java:20)
	at stanhebben.zenscript.type.ZenType.<clinit>(MixinZenType.java:42)
	at stanhebben.zenscript.compiler.TypeRegistry.mdc16869$zenutils$lambda$new$0$0(MixinTypeRegistry.java:546)
	at youyihj.zenutils.impl.util.InternalUtils.make(InternalUtils.java:130)
	at stanhebben.zenscript.compiler.TypeRegistry.<init>(MixinTypeRegistry.java:17)
	at crafttweaker.zenscript.GlobalRegistry.<clinit>(GlobalRegistry.java:29)
	at crafttweaker.CraftTweakerAPI.getJavaStaticGetterSymbol(MixinCraftTweakerAPI.java:343)
	at crafttweaker.CraftTweakerAPI.<clinit>(MixinCraftTweakerAPI.java:111)
	at youyihj.zenutils.impl.zenscript.mixin.ZenMixin.load(ZenMixin.java:45)
	at youyihj.zenutils.impl.core.ZenUtilsPlugin.injectData(ZenUtilsPlugin.java:58)
	at net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:131)
	at top.outlands.foundation.LaunchHandler.launch(LaunchHandler.java:107)
	at top.outlands.foundation.boot.Foundation.main(Foundation.java:43)
Caused by: java.lang.RuntimeException: java.nio.file.FileSystemException: libraries/com/cleanroommc/cleanroom/0.6.11-alpha/cleanroom-0.6.11-alpha.jar:libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:...(about 130 entries)...:libraries/net/minecraft/server/1.12.2/server-1.12.2.jar: File name too long
	at youyihj.zenutils.impl.util.DeobfMinecraftBytesProvider.getClassPath(DeobfMinecraftBytesProvider.java:76)
	at youyihj.zenutils.impl.util.DeobfMinecraftBytesProvider.<init>(DeobfMinecraftBytesProvider.java:31)
	at youyihj.zenutils.impl.util.InternalUtils.lambda$static$0(InternalUtils.java:48)
	at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:194)
	at youyihj.zenutils.impl.util.InternalUtils.getClassDataFetcher(InternalUtils.java:140)
	at stanhebben.zenscript.compiler.TypeRegistry.handler$zbb000$zenutils$redirectToJavaNative(MixinTypeRegistry.java:608)
	at stanhebben.zenscript.compiler.TypeRegistry.getClassType(MixinTypeRegistry.java:52)
	at stanhebben.zenscript.compiler.TypeRegistry.getType(MixinTypeRegistry.java:79)
	at stanhebben.zenscript.compiler.TypeRegistry.handler$zbb000$zenutils$handleComplexTypes(MixinTypeRegistry.java:592)
	at stanhebben.zenscript.compiler.TypeRegistry.getType(MixinTypeRegistry.java)
	at stanhebben.zenscript.compiler.TypeRegistry.handler$zbb000$zenutils$handleComplexTypes(MixinTypeRegistry.java:595)
	at stanhebben.zenscript.compiler.TypeRegistry.getType(MixinTypeRegistry.java)
	at stanhebben.zenscript.type.natives.JavaMethod.<init>(JavaMethod.java:41)
	at stanhebben.zenscript.type.ZenTypeArrayBasic.mdc16869$zenutils$lambda$static$1$0(MixinZenTypeArrayBasic.java:541)
	at youyihj.zenutils.impl.util.InternalUtils.make(InternalUtils.java:130)
	at stanhebben.zenscript.type.ZenTypeArrayBasic.<clinit>(MixinZenTypeArrayBasic.java:535)
	... 15 more
Caused by: java.nio.file.FileSystemException: libraries/com/cleanroommc/cleanroom/0.6.11-alpha/cleanroom-0.6.11-alpha.jar:libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:...(about 130 entries)...:libraries/net/minecraft/server/1.12.2/server-1.12.2.jar: File name too long
	at sun.nio.fs.UnixException.translateToIOException(Unknown Source)
	at sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
	at sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
	at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(Unknown Source)
	at sun.nio.fs.UnixFileSystemProvider.readAttributes(Unknown Source)
	at sun.nio.fs.LinuxFileSystemProvider.readAttributes(Unknown Source)
	at java.nio.file.Files.readAttributes(Unknown Source)
	at java.util.zip.ZipFile$Source.get(Unknown Source)
	at java.util.zip.ZipFile$CleanableResource.<init>(Unknown Source)
	at java.util.zip.ZipFile.<init>(Unknown Source)
	at java.util.zip.ZipFile.<init>(Unknown Source)
	at java.util.jar.JarFile.<init>(Unknown Source)
	at java.util.jar.JarFile.<init>(Unknown Source)
	at java.util.jar.JarFile.<init>(Unknown Source)
	at youyihj.zenutils.impl.util.DeobfMinecraftBytesProvider.getClassPath(DeobfMinecraftBytesProvider.java:68)
	... 30 more

Cause

On a dedicated server (not dev, side is not CLIENT), DeobfMinecraftBytesProvider.getClassPath() reads System.getProperty("java.class.path") and uses the full value as one path. It adds it with Paths.get(...) and opens it with new JarFile(...) to read the manifest Class-Path.

This matches a Forge-style java -jar forge-server.jar launch, where java.class.path holds one jar. The Cleanroom launch passes a list of jars separated by File.pathSeparator, so new JarFile(<whole list>) fails with FileSystemException: ...: File name too long (DeobfMinecraftBytesProvider.java:68).

Srdjan-V avatar Nov 05 '26 12:11 Srdjan-V

why not java -jar? Cleanroom can use this style too.

friendlyhj avatar Nov 05 '26 13:11 friendlyhj

I dont know if that will work but the Cleanroom installer will generate it like that, from what i can tell this is the default way its configured to boot.

root@a1-555727:/ssd/docker/minecraft/e2ee# cat run.sh
#!/usr/bin/env sh
# Generated by the Cleanroom Installer. Edit user_jvm_args.txt, not this file.

JAVA="${JAVA:-java}"

MAJOR=$("$JAVA" -version 2>&1 | head -n 1 | sed -E 's/.*version "([0-9]+).*/\1/')
if [ -n "$MAJOR" ] && { [ "$MAJOR" -lt 25 ] || [ "$MAJOR" -gt 25 ]; } 2>/dev/null; then
  echo "Cleanroom needs Java 25, but $JAVA is Java $MAJOR." >&2
  echo "Set JAVA to a supported runtime, or re-run the installer with --pin-java." >&2
  exit 1
fi

"$JAVA" @user_jvm_args.txt @libraries/com/cleanroommc/cleanroom/0.6.13-alpha/unix_args.txt "$@"


root@a1-555727:/ssd/docker/minecraft/e2ee# cat ./libraries/com/cleanroommc/cleanroom/0.6.13-alpha/unix_args.txt
-cp
libraries/com/cleanroommc/cleanroom/0.6.13-alpha/cleanroom-0.6.13-alpha.jar:libraries/com/paulscode/codecjorbis/20101023/
******************
cnet/minecraft/server/1.12.2/server-1.12.2.jar
top.outlands.foundation.boot.Foundation
--tweakClass
net.minecraftforge.fml.common.launcher.FMLServerTweaker

Srdjan-V avatar Nov 05 '26 13:11 Srdjan-V