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

Errors thrown when starting jbr_jcef-17.0.7 Minecraft Paper server. #490

Open
DevSock opened this issue Jul 30, 2023 · 7 comments
Open

Errors thrown when starting jbr_jcef-17.0.7 Minecraft Paper server. #490

DevSock opened this issue Jul 30, 2023 · 7 comments

Comments

@DevSock
Copy link

DevSock commented Jul 30, 2023

When I run my Debug Run Configuration that starts my Minecraft 1.20.1 Paper server using the JBR17.0.7 environment detailed below, I am met with a stacktrace in my terminal shortly after the configuration starts to boot my server. I have nothing within my project apart from a main class with very little functionality. It appears as though everything starts correctly, and it doesn't impede anything, but I'd rather have a clean terminal with my startup information displayed as opposed to a daunting stacktrace sitting above the pertinent details I'm looking for. It appears as though entirely disabling the log4j2 plugin resolves the errors on startup, but I'd still like to understand why this is the case, and if there is a better solution other than omitting the plugin entirely. I'm not actively using the log4j2 for my project, but I assume it's being used somewhere within the PaperAPI. I believe log4j (unsure if log4j2) is used by PaperMC to handle their logging implementation.

EDIT 1: Paper uses a custom classloader, and I'm assuming that this may have something to do with this issue. Explicitly setting the javaagent doesn't resolve my issue. I'm unsure as to whether or not the classloader is to blame here, or whether it's something the PaperMC developers are doing with their implementation of log4j2, or if it's something else entirely. I will continue to research and keep this issue updated with relevant information regarding my findings and continued testing/debugging.

--Environment Specific Details--
JRE: JBR_JCEF-17.0.7
HotswapAgent: 1.4.2 (Pre-Release)
Gradle: 1.8.2
IntelliJ IDEA Ultimate: 2023.2
Paper-API: 1.20.1

-----------VM Arguments-------------
-Xlog:redefine+class*=info
-XX:+AllowEnhancedClassRedefinition
-XX:HotswapAgent=fatjar
-Xms10G
-Xmx10G
-XX:+UseG1GC
-XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=200
-XX:+UnlockExperimentalVMOptions
-XX:+DisableExplicitGC
-XX:+AlwaysPreTouch
-XX:G1NewSizePercent=30
-XX:G1MaxNewSizePercent=40
-XX:G1HeapRegionSize=8M
-XX:G1ReservePercent=20
-XX:G1HeapWastePercent=5
-XX:G1MixedGCCountTarget=4
-XX:InitiatingHeapOccupancyPercent=15
-XX:G1MixedGCLiveThresholdPercent=90
-XX:G1RSetUpdatingPauseTimePercent=5
-XX:SurvivorRatio=32
-XX:+PerfDisableSharedMem
-XX:MaxTenuringThreshold=1
-Dusing.aikars.flags=https://mcflags.emc.gs
-Daikars.new.flags=true

----Stacktrace---------
Connected to the target VM, address: '127.0.0.1:55781', transport: 'socket'
HOTSWAP AGENT: 12:27:39.372 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.4.2-SNAPSHOT} - unlimited runtime class redefinition.
HOTSWAP AGENT: 12:27:39.562 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, WatchResources, AnonymousClassPatch, ClassInitPlugin, JdkPlugin, Hibernate, HibernateJakarta, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Omnifaces, ELResolver, WildFlyELResolver, OsgiEquinox, Owb, OwbJakarta, Proxy, WebObjects, Weld, WeldJakarta, JBossModules, ResteasyRegistry, Deltaspike, GlassFish, Weblogic, Vaadin, Wicket, CxfJAXRS, FreeMarker, Undertow, MyBatis, IBatis, JacksonPlugin, Idea, Thymeleaf, Velocity]
Starting HotswapAgent 'C:\Program Files\Java\jbr_jcef-17.0.7-windows-x64-b1000.6\lib\hotswap\hotswap-agent.jar'
Starting org.bukkit.craftbukkit.Main
HOTSWAP AGENT: 12:27:40.329 ERROR (org.hotswap.agent.annotation.handler.PluginClassFileTransformer) - InvocationTargetException in transform method on plugin 'class org.hotswap.agent.plugin.log4j2.Log4j2Plugin' class 'org/apache/logging/log4j/core/LoggerContext'.
java.lang.reflect.InvocationTargetException
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 org.hotswap.agent.annotation.handler.PluginClassFileTransformer.transform(PluginClassFileTransformer.java:220)
at org.hotswap.agent.annotation.handler.PluginClassFileTransformer.transform(PluginClassFileTransformer.java:112)
at org.hotswap.agent.util.HotswapTransformer.transform(HotswapTransformer.java:250)
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:1012)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at org.bukkit.craftbukkit.Main.tryPreloadClass(Main.java:373)
at org.bukkit.craftbukkit.Main.tryPreloadClass(Main.java:369)
at org.bukkit.craftbukkit.Main.main(Main.java:197)
at io.papermc.paperclip.Paperclip.lambda$main$0(Paperclip.java:42)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.hotswap.agent.javassist.CannotCompileException: [source error] no such class: org.hotswap.agent.config.PluginManager
at org.hotswap.agent.javassist.CtBehavior.insertAfter(CtBehavior.java:909)
at org.hotswap.agent.javassist.CtBehavior.insertAfter(CtBehavior.java:824)
at org.hotswap.agent.plugin.log4j2.Log4j2Plugin.registerConfigurator(Log4j2Plugin.java:154)
... 27 more
Caused by: compile error: no such class: org.hotswap.agent.config.PluginManager
at org.hotswap.agent.javassist.compiler.MemberResolver.searchImports(MemberResolver.java:479)
at org.hotswap.agent.javassist.compiler.MemberResolver.lookupClass(MemberResolver.java:422)
at org.hotswap.agent.javassist.compiler.MemberResolver.lookupClassByJvmName(MemberResolver.java:329)
at org.hotswap.agent.javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:711)
at org.hotswap.agent.javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:170)
at org.hotswap.agent.javassist.compiler.ast.CallExpr.accept(CallExpr.java:49)
at org.hotswap.agent.javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:693)
at org.hotswap.agent.javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:170)
at org.hotswap.agent.javassist.compiler.ast.CallExpr.accept(CallExpr.java:49)
at org.hotswap.agent.javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:693)
at org.hotswap.agent.javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:170)
at org.hotswap.agent.javassist.compiler.ast.CallExpr.accept(CallExpr.java:49)
at org.hotswap.agent.javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:266)
at org.hotswap.agent.javassist.compiler.CodeGen.atStmnt(CodeGen.java:360)
at org.hotswap.agent.javassist.compiler.ast.Stmnt.accept(Stmnt.java:53)
at org.hotswap.agent.javassist.compiler.Javac.compileStmnt(Javac.java:578)
at org.hotswap.agent.javassist.CtBehavior.insertAfterAdvice(CtBehavior.java:931)
at org.hotswap.agent.javassist.CtBehavior.insertAfter(CtBehavior.java:883)
... 29 more

System Info: Java 17 (OpenJDK 64-Bit Server VM 17.0.7+7-b1000.6) Host: Windows 11 10.0 (amd64)
Loading libraries, please wait...
2023-07-29 21:55:38,137 ServerMain WARN Advanced terminal features are not available in this environment
[21:55:42 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[21:55:43 INFO]: Loaded 7 recipes
[21:55:43 INFO]: Starting minecraft server version 1.20.1
[21:55:43 INFO]: Loading properties
[21:55:43 INFO]: This server is running Paper version git-Paper-95 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: aa93dcf)
[21:55:43 INFO]: Server Ping Player Sample Count: 12
[21:55:43 INFO]: Using 4 threads for Netty based IO
[21:55:44 WARN]: [!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future.
We recommend installing the spark profiler as a replacement: https://spark.lucko.me/
For more information please visit: PaperMC/Paper#8948
[21:55:44 INFO]: [ChunkTaskScheduler] Chunk system is using 1 I/O threads, 5 worker threads, and gen parallelism of 5 threads
[21:55:44 INFO]: Default game type: SURVIVAL
[21:55:44 INFO]: Generating keypair
[21:55:44 INFO]: Starting Minecraft server on *:25565
[21:55:44 INFO]: Using default channel type
[21:55:44 INFO]: Paper: Using Java compression from Velocity.
[21:55:44 INFO]: Paper: Using Java cipher from Velocity.
[21:55:44 INFO]: [RemindMe] Loading server plugin RemindMe v1.0-SNAPSHOT
[21:55:44 INFO]: Server permissions file permissions.yml is empty, ignoring it
[21:55:44 INFO]: [RemindMe] Enabling RemindMe v1.0-SNAPSHOT
[21:55:44 INFO]: Preparing level "world"
[21:55:45 INFO]: Preparing start region for dimension minecraft:overworld
[21:55:45 INFO]: Time elapsed: 183 ms
[21:55:45 INFO]: Preparing start region for dimension minecraft:the_nether
[21:55:45 INFO]: Time elapsed: 13 ms
[21:55:45 INFO]: Preparing start region for dimension minecraft:the_end
[21:55:45 INFO]: Time elapsed: 10 ms
[21:55:45 INFO]: Running delayed init tasks
[21:55:45 INFO]: Done (1.602s)! For help, type "help"
[21:55:45 INFO]: Timings Reset

@aaa8881
Copy link

aaa8881 commented Oct 14, 2023

have you managed to solve the issue? I'm encountering same issue on the latest hotswap agent

@baba43
Copy link

baba43 commented Nov 20, 2023

Guys did you manage to find a solution since I have the same issue?

@DevSock @aaa8881

@aaa8881
Copy link

aaa8881 commented Nov 22, 2023

Guys did you manage to find a solution since I have the same issue?

@DevSock @aaa8881

I did manage to fix by disabling log4j in jvm args. I think one of threads I found in stackoverflow worked. can't recall what it was. however I'm not using it anymore but rather just using remote jvm feature in intelliJ. It's built in and works well.

@H4kt
Copy link

H4kt commented Dec 5, 2023

Hotswap itself does not work either

[14:55:06 INFO]: [STDOUT] [org.hotswap.agent.logging.AgentLoggerHandler] HOTSWAP AGENT: 14:55:06.223 ERROR (org.hotswap.agent.plugin.jdk.JdkPlugin) - classReload() exception No such field java.beans.Introspector.declaredMethodCache on null.
[14:55:06 INFO]: [STDOUT] [org.hotswap.agent.logging.AgentLoggerHandler] HOTSWAP AGENT: 14:55:06.224 ERROR (org.hotswap.agent.plugin.jdk.JdkPlugin) - classReload() exception class java.io.ObjectStreamClass$Caches$1 cannot be cast to class java.util.Map (java.io.ObjectStreamClass$Caches$1 and java.util.Map are in module java.base of loader 'bootstrap').
[14:55:06 INFO]: [STDOUT] [org.hotswap.agent.logging.AgentLoggerHandler] HOTSWAP AGENT: 14:55:06.229 ERROR (org.hotswap.agent.annotation.handler.PluginClassFileTransformer) - InvocationTargetException in transform method on plugin 'class org.hotswap.agent.plugin.proxy.ProxyPlugin' class 'dev/h4kt/randomActivities/commands/CommandActivity'.
java.lang.reflect.InvocationTargetException
        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 org.hotswap.agent.annotation.handler.PluginClassFileTransformer.transform(PluginClassFileTransformer.java:218)
        at org.hotswap.agent.annotation.handler.PluginClassFileTransformer.transform(PluginClassFileTransformer.java:112)
        at org.hotswap.agent.util.HotswapTransformer.transform(HotswapTransformer.java:246)
        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)
Caused by: java.lang.NoClassDefFoundError: org/hotswap/agent/logging/AgentLogger
        at RandomActivities-1.0.jar//org.hotswap.agent.plugin.proxy.hscglib.GeneratorParametersRecorder.<clinit>(GeneratorParametersRecorder.java:38)
        at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
        at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
        at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:42)
        at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:185)
        at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1132)
        at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1113)
        at java.base/java.lang.reflect.Field.get(Field.java:425)
        at org.hotswap.agent.plugin.proxy.hscglib.GeneratorParametersTransformer.getGeneratorParamsMap(GeneratorParametersTransformer.java:103)
        at org.hotswap.agent.plugin.proxy.hscglib.GeneratorParametersTransformer.getGeneratorParams(GeneratorParametersTransformer.java:130)
        at org.hotswap.agent.plugin.proxy.ProxyPlugin.transformCglibProxy(ProxyPlugin.java:105)
        ... 10 more
Caused by: java.lang.ClassNotFoundException: org.hotswap.agent.logging.AgentLogger
        at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:142)
        at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:103)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        ... 21 more

@raikasdev
Copy link

raikasdev commented Apr 27, 2024

The AgentLogger issue (at least on debugging Minecraft plugins) can be "fixed" by disabling the Proxy plugin.

-javaagent:/route/to/jbr/lib/hotswap/hotswap-agent.jar=disablePlugin=log4j2,disablePlugin=proxy

@UltraBlackLinux
Copy link

UltraBlackLinux commented May 6, 2024

I just recompiled the hotswap agent with all the stuff I don't need removed and it does work now, with zero issues.

@xtb7
Copy link

xtb7 commented Jul 15, 2024

I faced the same thing as you guys. I explained in my videos that only core, not fatjar works for me. Use core.

This was specifically how I set it up for Paper: https://youtu.be/yQVLT6sDg68
And this is just generally how I got it working for Java 21: https://youtu.be/iQSvTkyiIDY

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

No branches or pull requests

7 participants