Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Dynamically attach agent failed: java.lang.InternalError: class redefinition failed: invalid class #263

Closed
awa-crescent opened this issue Aug 24, 2024 · 1 comment
Labels

Comments

@awa-crescent
Copy link

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

@yushijinhun
Copy link
Owner

Attaching authlib-injector at runtime is not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants