Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bungeecord 启动时报错 #4

Closed
heartalborada-del opened this issue Aug 12, 2022 · 2 comments
Closed

bungeecord 启动时报错 #4

heartalborada-del opened this issue Aug 12, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@heartalborada-del
Copy link

heartalborada-del commented Aug 12, 2022

如题,启动时报错,Openjdk 18
以下为报错抛出的异常
21:24:14 [警告] Exception encountered when loading plugin: HAProxyDetector
java.lang.InternalError: java.lang.IllegalAccessException: static final field has no write access: net.md_5.bungee.netty.PipelineUtils.SERVER_CHILD/io.netty.channel.ChannelInitializer/putStatic, from class java.lang.Object (module java.base)
at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newFieldAccessor(MethodHandleAccessorFactory.java:167)
at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:176)
at java.base/java.lang.reflect.Field.acquireOverrideFieldAccessor(Field.java:1184)
at java.base/java.lang.reflect.Field.getOverrideFieldAccessor(Field.java:1153)
at java.base/java.lang.reflect.Field.get(Field.java:428)
at net.andylizi.haproxydetector.bungee.BungeeMain.onEnable(BungeeMain.java:102)
at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:265)
at net.md_5.bungee.BungeeCord.start(BungeeCord.java:285)
at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
Caused by: java.lang.IllegalAccessException: static final field has no write access: net.md_5.bungee.netty.PipelineUtils.SERVER_CHILD/io.netty.channel.ChannelInitializer/putStatic, from class java.lang.Object (module java.base)
at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:955)
at java.base/java.lang.invoke.MethodHandles$Lookup.unreflectField(MethodHandles.java:3494)
at java.base/java.lang.invoke.MethodHandles$Lookup.unreflectSetter(MethodHandles.java:3485)
at java.base/java.lang.invoke.MethodHandleImpl$1.unreflectField(MethodHandleImpl.java:1637)
at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newFieldAccessor(MethodHandleAccessorFactory.java:145)
... 9 more

@andylizi
Copy link
Owner

唉,Java 现在对反射的限制是一天比一天紧了。我这样的魔法操作以后估计很难再成功了……

查了点资料,问题的原因我基本是弄清楚了。但要从根本上解决的话,插件的整个实现思路估计要大手术,甚至有可能根本无法做到。我得仔细想想……

一个临时方案是给启动参数加上 -Djdk.reflect.useDirectMethodHandle=false,你可以先试一试救急。但未来 Java 版本中这个参数会被移除。

@andylizi
Copy link
Owner

andylizi commented Aug 13, 2022

修了,比预想的简单。v3.0.2

@andylizi andylizi added the bug Something isn't working label Jan 31, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants