yushijinhun / authlib-injector

Build your own Minecraft authentication system.
https://authlib-injector.yushi.moe
GNU Affero General Public License v3.0
755 stars 68 forks source link

Httpd failed to start #235

Closed PTALTS-LK closed 9 months ago

PTALTS-LK commented 9 months ago

尝试在1.20.1 forge 47.2.20服务端使用 使用littleskin 启动过程中authlib-injector输出Httpd failed to start 启动完成后通过HMCL第三方登陆littleskin进入服务器,提示无效会话 使用authlib-injector-1.2.4

这可能是日志的关键部分:

[authlib-injector] [WARNING] Failed to transform [com/mojang/authlib/yggdrasil/YggdrasilEnvironment]
java.lang.IllegalStateException: Httpd failed to start
        at moe.yushi.authlibinjector.httpd.URLProcessor.getLocalApiPort(URLProcessor.java:117)
        at moe.yushi.authlibinjector.httpd.URLProcessor.transform(URLProcessor.java:100)
        at moe.yushi.authlibinjector.httpd.URLProcessor.transformURL(URLProcessor.java:83)
        at moe.yushi.authlibinjector.transform.support.ConstantURLTransformUnit.transformLdc(ConstantURLTransformUnit.java:34)
        at moe.yushi.authlibinjector.transform.LdcTransformUnit$1$1.visitLdcInsn(LdcTransformUnit.java:49)
        at moe.yushi.authlibinjector.internal.org.objectweb.asm.ClassReader.readCode(ClassReader.java:2423)
        at moe.yushi.authlibinjector.internal.org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1515)
        at moe.yushi.authlibinjector.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:745)
        at moe.yushi.authlibinjector.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
        at moe.yushi.authlibinjector.transform.ClassTransformer$TransformHandle.accept(ClassTransformer.java:163)
        at moe.yushi.authlibinjector.transform.ClassTransformer.transform(ClassTransformer.java:288)
        at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
        at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:119)
        at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219)
        at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229)
        at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219)
        at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:135)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        at MC-BOOTSTRAP/authlib@4.0.43/com.mojang.authlib.EnvironmentParser.getEnvironmentFromProperties(EnvironmentParser.java:31)
        at MC-BOOTSTRAP/authlib@4.0.43/com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.determineEnvironment(YggdrasilAuthenticationService.java:64)
        at MC-BOOTSTRAP/authlib@4.0.43/com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.<init>(YggdrasilAuthenticationService.java:41)
        at TRANSFORMER/minecraft@1.20.1/net.minecraft.server.Main.main(Main.java:134)
        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 MC-BOOTSTRAP/fmlloader@1.20.1-47.2.20/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111)
        at MC-BOOTSTRAP/fmlloader@1.20.1-47.2.20/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.serverService(CommonLaunchHandler.java:103)
        at MC-BOOTSTRAP/fmlloader@1.20.1-47.2.20/net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$makeService$0(CommonServerLaunchHandler.java:27)
        at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30)
        at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)
        at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)
        at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.run(Launcher.java:108)
        at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.main(Launcher.java:78)
        at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
        at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
        at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
[19:54:55] [main/INFO] [mojang/YggdrasilAuthenticationService]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[authlib-injector] [INFO] Transformed [com.mojang.authlib.yggdrasil.YggdrasilServicesKeyInfo] with [Yggdrasil Public Key Transformer]

完整日志

latest.log

服务器启动参数:

java -Xmx4G -javaagent:/root/mc/1.20.1/authlib-injector.jar=https://littleskin.cn/api/yggdrasil @libraries/net/minecraftforge/forge/1.20.1-47.2.20/unix_args.txt nogui "$@"

没有对unix_args.txt进行修改

服务器配置文件:

#Minecraft server properties
#Tue Jan 30 19:54:55 CST 2024
allow-flight=true
allow-nether=true
broadcast-console-to-ops=true
broadcast-rcon-to-ops=true
difficulty=hard
enable-command-block=false
enable-jmx-monitoring=false
enable-query=false
enable-rcon=false
enable-status=true
enforce-secure-profile=true
enforce-whitelist=false
entity-broadcast-range-percentage=100
force-gamemode=false
function-permission-level=2
gamemode=survival
generate-structures=true
generator-settings={}
hardcore=false
hide-online-players=false
initial-disabled-packs=
initial-enabled-packs=vanilla
level-name=shia
level-seed=
level-type=minecraft\:normal
max-chained-neighbor-updates=1000000
max-players=20
max-tick-time=60000
max-world-size=29999984
motd=Running on Kimi's host
network-compression-threshold=256
online-mode=true
op-permission-level=4
player-idle-timeout=0
prevent-proxy-connections=false
pvp=true
query.port=25565
rate-limit=0
rcon.password=
rcon.port=25575
require-resource-pack=false
resource-pack=
resource-pack-prompt=
resource-pack-sha1=
server-ip=0.0.0.0
server-port=25565
simulation-distance=10
spawn-animals=true
spawn-monsters=true
spawn-npcs=true
spawn-protection=0
sync-chunk-writes=true
text-filtering-config=
use-native-transport=true
view-distance=10
white-list=false

在debian 12上运行

qyl27 commented 9 months ago

我记得以前听说过部分 linux 发行版对于监听端口的进程做了限制……
用 sudo 启动试试?这样子可以排除此问题
相关的解决方法要看对应发行版的文档。

PTALTS-LK commented 9 months ago

我记得以前听说过部分 linux 发行版对于监听端口的进程做了限制…… 用 sudo 启动试试?这样子可以排除此问题 相关的解决方法要看对应发行版的文档。

就是在root用户下运行的

PTALTS-LK commented 9 months ago

我记得以前听说过部分 linux 发行版对于监听端口的进程做了限制…… 用 sudo 启动试试?这样子可以排除此问题 相关的解决方法要看对应发行版的文档。

我如果不指定server-ip的话,连服务端都无法绑定端口 这问题我自己的电脑上没有出现,而在我的debian 12服务器上出现

qyl27 commented 9 months ago

那,试试指定一个端口号?
如果只想开起来的话,直接禁用内置httpd,也是可以用的

PTALTS-LK commented 9 months ago

那,试试指定一个端口号? 如果只想开起来的话,直接禁用内置httpd吧

how to

qyl27 commented 9 months ago

看看项目的 readme 如何?

PTALTS-LK commented 9 months ago

看看项目的 readme 如何?

我尝试添加了-Dauthlibinjector.httpdPort=25577-javaagent:/root/mc/1.20.1/authlib-injector.jar=https://littleskin.cn/api/yggdrasil的后面,依然输出java.lang.IllegalStateException: Httpd failed to start

PTALTS-LK commented 9 months ago

看看项目的 readme 如何?

我尝试添加了-Dauthlibinjector.httpdPort=25577-javaagent:/root/mc/1.20.1/authlib-injector.jar=https://littleskin.cn/api/yggdrasil的后面,依然输出java.lang.IllegalStateException: Httpd failed to start

此时依然无法加入服务器(无效会话)

qyl27 commented 9 months ago

直接禁用内置httpd在大部分情况下是不影响使用的

PTALTS-LK commented 9 months ago

看看项目的 readme 如何?

使用了-Dauthlibinjector.disableHttpd之后确实能够正常进入游戏了

PTALTS-LK commented 9 months ago

直接禁用内置httpd在大部分情况下是不影响使用的

谢谢啦~