itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.59k stars 1.56k forks source link

failed to prepare forge, unable to find version.json #640

Closed xchoice closed 4 years ago

xchoice commented 4 years ago

Modpack: The Pixelmon Modpack (https://www.curseforge.com/minecraft/modpacks/the-pixelmon-modpack) docker-compose.yaml

version: "3.7"

services:
  mc:
    image: itzg/minecraft-server
    container_name: pixelmon
    restart: unless-stopped
    ports:
      - 25565:25565
    volumes:
      - /srv/minecraft/pixelmon:/data
    environment:
      EULA: "TRUE"
      MEMORY: 3G
      TYPE: CURSE_INSTANCE
      VERSION: 1.12.2
      CURSE_INSTANCE_JSON: minecraftinstance.json

from the log:

[init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x    3 1000     1000          4096 Oct  2 05:39 /data'
[init] Resolved version given 1.12.2 into 1.12.2
[init] Resolving type given CURSE_INSTANCE
[init] Resolved CURSE_INSTANCE_JSON as minecraftinstance.json
[init] server.properties already created, skipping
[init] log4j2.xml already created, skipping
[init] Checking for JSON files.
[init] Setting initial memory to 3G and max to 3G
2020-10-02T05:39:12.321Z        INFO    mc-server-runner.cfsync Preparing Twitch/Curse instance {"name": "The Pixelmon Modpack"}
2020-10-02T05:39:12.321Z        INFO    mc-server-runner.cfsync Preparing forge server
2020-10-02T05:39:12.321Z        INFO    mc-server-runner.cfsync Preparing libraries for forge server
2020-10-02T05:39:12.322Z        FATAL   mc-server-runner        Failed to prepare instance      {"error": "failed to prepare forge: failed to prepare libraries: unable to find version.json in forge-1.12.2-14.23.5.2854.jar"}
itzg commented 4 years ago

The CURSE_INSTANCE type is still an early access feature, so it'll help a lot if you could post the minecraftinstance.json file that you're using.

xchoice commented 4 years ago

minecraftinstance.txt

renamed .txt as to be able to upload it here.

itzg commented 4 years ago

Just a quick update, I was able to hit the same error you reported using that file.

itzg commented 4 years ago

Oh...the location of the version.json that the tool is using to find the forge dependency libraries is apparently not guaranteed to be in any particular location or exist at all. The latter is the case for 1.12 apparently.

https://forums.minecraftforge.net/topic/69608-is-there-a-reason-the-versionjson-location-is-different-in-113/

The good news is that I see the Curse/Twitch instance JSON has embedded the version json in a field. I'll work on enhancing that.

xchoice commented 4 years ago

why is this version.json needed at all?

I mean you can get the forge version from the manifest.json file { "minecraft": { "version": "1.12.2", "modLoaders": [ { "id": "forge-14.23.5.2854", "primary": true } ] }

And from what little I understand, forge takes care of itself when it comes to dependencies.

That said, I don't really care, I just want to play pokemon+minecraft with some friends and found your sever quiet easy to set up on docker :D

itzg commented 4 years ago

The version.json declares the libraries that forge itself needs. Normally the forge installer takes care of downloading all of those, but in the Curse/Twitch instance file it doesn't provide info about the installer, but instead the regular server jar. So the tool is having to reverse engineer download info.

I'm hitting some issues now where the download URLs are requiring authentication against the content delivery network...so I might be stuck.

Meanwhile, I was going to suggest downloading the server modpack zip and using TYPE=CURSEFORGE; however, they're not providing a server modpack :( . So far I'm not finding any bug reports regarding that.

As a last resort, it likes like TYPE=FORGE needs to be used with the mods pre-downloaded into a /mods volume as described here.

That modpack sure made it trickier than normal.

itzg commented 4 years ago

Here's a compose file and directory layout that I tried to test:

version: "3.8"

services:
  mc:
    image: itzg/minecraft-server
    ports:
        - 25565:25565
    environment:
      EULA: "TRUE"
      TYPE: FORGE
      VERSION: 1.12.2
    volumes:
        - ./mods:/mods

image

but the server crashed on connection, ugh:

mc_1  | [19:03:31] [Server thread/ERROR]: Exception caught during firing event net.minecraftforge.fml.common.gameevent.TickEvent$ServerTickEvent@fdfe5c1:
mc_1  | java.util.ConcurrentModificationException: null
mc_1  |         at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) ~[?:1.8.0_212]
mc_1  |         at java.util.ArrayList$Itr.next(ArrayList.java:859) ~[?:1.8.0_212]
mc_1  |         at de.waterdu.gameshark.event.ServerEventHandler.handleTick(ServerEventHandler.java:110) ~[ServerEventHandler.class:?]
mc_1  |         at de.waterdu.gameshark.event.ServerEventHandler.onTick(ServerEventHandler.java:69) ~[ServerEventHandler.class:?]
mc_1  |         at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_110_ServerEventHandler_onTick_ServerTickEvent.invoke(.dynamic) ~[?:?]
mc_1  |         at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
mc_1  |         at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?]
mc_1  |         at net.minecraftforge.fml.common.FMLCommonHandler.onPostServerTick(FMLCommonHandler.java:266) [FMLCommonHandler.class:?]
mc_1  |         at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:712) [MinecraftServer.class:?]mc_1  |         at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
mc_1  |         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
mc_1  | [19:03:31] [Server thread/ERROR]: Index: 3 Listeners:
mc_1  | [19:03:31] [Server thread/ERROR]: 0: NORMAL
mc_1  | [19:03:31] [Server thread/ERROR]: 1: ASM: net.minecraftforge.common.ForgeInternalHandler@359d05fb onServerTick(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ServerTickEvent;)V
mc_1  | [19:03:31] [Server thread/ERROR]: 2: ASM: com.pixelmonmod.pixelmon.TickHandler@23a3cbb8 onServerTick(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ServerTickEvent;)V
mc_1  | [19:03:31] [Server thread/ERROR]: 3: ASM: de.waterdu.gameshark.event.ServerEventHandler@1f05df4d onTick(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ServerTickEvent;)V
mc_1  | [19:03:31] [Server thread/ERROR]: 4: ASM: journeymap.server.events.ForgeEvents@e57f5d8 onServerTickEvent(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ServerTickEvent;)V
mc_1  | [19:03:31] [Server thread/ERROR]: 5: ASM: com.pixelmonmod.pixelmon.spawning.TrackingSpawnerCoordinator@26acf0f onTick(Lnet/minecraftforge/fml/common/gameevent/TickEvent$ServerTickEvent;)V
mc_1  | [19:03:31] [Server thread/ERROR]: Encountered an unexpected exception
mc_1  | java.util.ConcurrentModificationException: null
mc_1  |         at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) ~[?:1.8.0_212]
mc_1  |         at java.util.ArrayList$Itr.next(ArrayList.java:859) ~[?:1.8.0_212]
mc_1  |         at de.waterdu.gameshark.event.ServerEventHandler.handleTick(ServerEventHandler.java:110) ~[ServerEventHandler.class:?]
mc_1  |         at de.waterdu.gameshark.event.ServerEventHandler.onTick(ServerEventHandler.java:69) ~[ServerEventHandler.class:?]
mc_1  |         at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_110_ServerEventHandler_onTick_ServerTickEvent.invoke(.dynamic) ~[?:?]
mc_1  |         at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
mc_1  |         at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?]
mc_1  |         at net.minecraftforge.fml.common.FMLCommonHandler.onPostServerTick(FMLCommonHandler.java:266) ~[FMLCommonHandler.class:?]
mc_1  |         at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:712) ~[MinecraftServer.class:?]
mc_1  |         at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
mc_1  |         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
mc_1  | [19:03:31] [Server thread/ERROR]: This crash report has been saved to: /data/./crash-reports/crash-2020-10-03_19.03.31-server.txt
itzg commented 4 years ago

...what an adventure, which is oddly appropriate. Gameshark mod 6.0.4 fixed the exception above. So, here's the final compose file and directory layout:

version: "3.8"

services:
  mc:
    image: itzg/minecraft-server
    ports:
        - 25565:25565
    environment:
      EULA: "TRUE"
      TYPE: FORGE
      VERSION: 1.12.2
    volumes:
        - ./mods:/mods
        - pixelmon:/data

volumes:
    pixelmon: {}

image

xchoice commented 4 years ago

It's working now!

for the record, my docker-compose.yaml

version: "3.8"
services:
  mc:
    image: itzg/minecraft-server
    container_name: pixelmon
    restart: unless-stopped
    ports:
      - 25565:25565
    volumes:
      - /srv/minecraft/pixelmon:/data
    environment:
      EULA: "TRUE"
      MEMORY: 3G
      TYPE: FORGE
      VERSION: 1.12.2

I mount only /data, and use samba in /srv to copy the mods configs etc.