PaperMC / Paperclip

Bootstrap utility and launcher for the Paper Minecraft server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot start server without internet access anymore

TheAkio opened this issue · comments

commented

Previously I was using java -jar -Dpaperclip.patchonly=true paperclip.jar to generate the patched Paper JAR file and then starting that patched JAR directly which worked fine. With 1.18 (at least that's when I started noticing it), starting the patched JAR itself does not work anymore which is fine because I assume this was never actually supported.

However running the server using the paperclip.jar after having it patched once still tries to download the Mojang Server JAR and apply patches to it. This is an issue for me when running a server in an environment without internet access.

I checked the code for a switch to disable this but I didn't find one.
Is running the server without internet access supported (After patching once of course)?
Some kind of flag like -Dpaperclip.offline=true would be helpful.
If there's a technical reason why starting the server offline does not work anymore that's fine too.

commented

Cannot reproduce, running the server (via paperclip, after first running with internet) without internet still seems to work fine. do you get an exception, or does it just hang? If it's just hanging, please get a thread dump via jstack or similar.

commented

Ok I might have jumped to a conclusion a bit too fast here. When starting the server once with internet, then going offline and starting it again it works.

I should add that I'm trying to create a personal docker container to deploy the server so this probably has something to do with it. I just checked again and just running with -Dpaperclip.patchonly=true and starting it afterwards it still tries to download & patch the JAR files. Are you able to reproduce that?

I would assume running it with -Dpaperclip.patchonly=true prepares everything but there may be something that only happens once the server is started?

Will also try to reproduce this behavior without using Docker.

commented

no that also works fine. what is the exception exactly/what actually happens when you try to start the server with no internet?

commented

The exception is the following:

Downloading mojang_1.18.1.jar
Failed to download mojang_1.18.1.jar
java.net.UnknownHostException: launcher.mojang.com
        at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
        at java.base/java.net.Socket.connect(Socket.java:633)
        at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:299)
        at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:174)
        at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:183)
        at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:498)
        at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603)
        at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:266)
        at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:380)
        at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:189)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128)
        at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:175)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1665)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
        at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
        at java.base/java.net.URL.openStream(URL.java:1161)
        at io.papermc.paperclip.DownloadContext.download(DownloadContext.java:53)
        at io.papermc.paperclip.Paperclip.setupClasspath(Paperclip.java:63)
        at io.papermc.paperclip.Paperclip.main(Paperclip.java:28)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.papermc.paperclip.Main.main(Main.java:26)

I do feel like I am messing up somewhere if patching first and starting offline afterwards works for you.

commented

ok yeah that does not make much sense, I guess ensure you're including both the cache, libraries, and versions folder in your container. in order to match vanilla changes in 1.18 not everything is stored in the cache folder.

commented

I was copying everything over yet it was still not working. I found the issue tho. It has to do with how I'm starting paperclip.jar.
As I don't want the paperclip.jar and any other JAR-Files or libraries to appear in the Docker volume where worlds and logs are I am basically having all those files one directory above:

paperclip.jar
cache
libraries
versions
server-directory (<-- This is CWD and starts ../paperclip.jar)

Paperclip probably tries to locate the required folders relative to CWD not relative to where paperclip.jar exists. This probably worked beforehand as I was not using Paperclip to start Paper.

Is there any way I might be able to pass where Paperclip should look for these files? Or would it make sense for paperclip to look relative to the JAR file generally?

If nothing works I might just be stuck with having these files inside the Docker volume and doing a cleanup of some sorts whenever I update the container.

commented

-DbundlerRepoDir=/path/to/where/you/want/stuff before -jar

commented

That works! Thank you for your time helping me debug this.
Closing this as the original issue did not exist and the real issue has been resolved.