authlib-injector works perfectly when using VM option "-javaagent:authlib-injector-1.2.5.jar=https://littleskin.cn/api/yggdrasil" at bootstrap time. However when I tried to attach it programmatically, class retransform failed. My code is just like this:
VirtualMachine jvm = VirtualMachine.attach(PID);
jvm.loadAgent(authlib_injector_path, auth_server_url);
jvm.detach();
And here is Stack trace:
[moe.yushi.authlibinjector.util.Logging] [authlib-injector] [INFO] Attempt to retransform all classes
[moe.yushi.authlibinjector.util.Logging] [authlib-injector] [WARNING] Failed to retransform
java.lang.InternalError: class redefinition failed: invalid class
at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:225)
at moe.yushi.authlibinjector.AuthlibInjector.retransformAllClasses(AuthlibInjector.java:338)
at moe.yushi.authlibinjector.Premain.initInjector(Premain.java:55)
at moe.yushi.authlibinjector.Premain.agentmain(Premain.java:43)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:560)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:582)
My minecraft server version is 1.21.0, and jdk version is 21, authlib-injector version is 1.2.5
authlib-injector works perfectly when using VM option "-javaagent:authlib-injector-1.2.5.jar=https://littleskin.cn/api/yggdrasil" at bootstrap time. However when I tried to attach it programmatically, class retransform failed. My code is just like this: VirtualMachine jvm = VirtualMachine.attach(PID); jvm.loadAgent(authlib_injector_path, auth_server_url); jvm.detach();
And here is Stack trace: [moe.yushi.authlibinjector.util.Logging] [authlib-injector] [INFO] Attempt to retransform all classes [moe.yushi.authlibinjector.util.Logging] [authlib-injector] [WARNING] Failed to retransform java.lang.InternalError: class redefinition failed: invalid class at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method) at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:225) at moe.yushi.authlibinjector.AuthlibInjector.retransformAllClasses(AuthlibInjector.java:338) at moe.yushi.authlibinjector.Premain.initInjector(Premain.java:55) at moe.yushi.authlibinjector.Premain.agentmain(Premain.java:43) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:560) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:582)
My minecraft server version is 1.21.0, and jdk version is 21, authlib-injector version is 1.2.5