Glowstone icon indicating copy to clipboard operation
Glowstone copied to clipboard

ASM library needs update for every JDK release

Open Foorack opened this issue 6 years ago • 14 comments

minecraft@ck1:~/dev$ java -Xms768M -XX:+UseG1GC -jar glowstone.jar                                                                              
19:31:01 [INFO] This server is running Glowstone version 2018.4.0.74959d8 (MC: 1.12.2) (Implementing API version 1.12.2-R4.0-SNAPSHOT)
19:31:02 [INFO] Recipes: 307 shaped, 63 shapeless, 26 furnace, 10 dynamic, 44 fuels.
19:31:02 [WARNING] The server is running in offline mode! Only do this if you know what you''re doing.
19:31:02 [INFO] Scanning plugins...
19:31:02 [SEVERE] Error during server startup.
java.lang.IllegalArgumentException
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at net.glowstone.GlowPluginTypeDetector.scanFile(GlowPluginTypeDetector.java:94)
        at net.glowstone.GlowPluginTypeDetector.scan(GlowPluginTypeDetector.java:45)
        at net.glowstone.GlowServer.loadPlugins(GlowServer.java:1232)
        at net.glowstone.GlowServer.start(GlowServer.java:772)
        at net.glowstone.GlowServer.run(GlowServer.java:627)
        at net.glowstone.GlowServer.main(GlowServer.java:491)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Foorack avatar May 05 '18 17:05 Foorack

What are the JAR files in your plugins/ folder?

mastercoms avatar May 05 '18 18:05 mastercoms

This seems to be caused at https://github.com/GlowstoneMC/Glowstone/blob/a5bc22f6212eb3b81dfe529758f6cd80203fb565/src/main/java/net/glowstone/GlowPluginTypeDetector.java#L94

Would it be possible to change https://github.com/GlowstoneMC/Glowstone/blob/a5bc22f6212eb3b81dfe529758f6cd80203fb565/src/main/java/net/glowstone/GlowPluginTypeDetector.java#L112 from IOException to Exception to catch this as well? It would be very helpful if it printed what file is causing the error.

Plugins folder on dev server: ekrankopio de 2018-05-05 20-21-56

Foorack avatar May 05 '18 18:05 Foorack

What Java version are you using? And can you try removing plugins 1 by 1 until it works?

aramperes avatar May 05 '18 18:05 aramperes

@momothereal

minecraft@ck1:~/dev$ java -version
openjdk version "9.0.4"
OpenJDK Runtime Environment (build 9.0.4+12-Ubuntu-116.04.york0)
OpenJDK 64-Bit Server VM (build 9.0.4+12-Ubuntu-116.04.york0, mixed mode)

I made the change mentioned in my previous post and it seems like 4 out of 5 of our custom plugins is causing that error. All plugins are compiled normally with maven and java 9.

Foorack avatar May 05 '18 19:05 Foorack

This seems to be because of an outdated version of ASM. We compile all our plugins towards Java 9. It is hardcoded to simply crash at anything newer than Java 8. Would it be possible to upgrade to a newer version of ASM?

https://gitlab.ow2.org/asm/asm/blob/ASM_5_0_4/src/org/objectweb/asm/ClassReader.java#L170

Foorack avatar May 05 '18 20:05 Foorack

ASM dependency is coming from GlowKit. It is currently using asm-all:5.0.4. Support for Java 9 and 10 was released in ASM 6. I managed to get it working by excluding asm-all and adding asm:6.1.1 and ask-commons:6.1.1. I created a merge request.

Foorack avatar May 05 '18 20:05 Foorack

I had the same issue today on Glowstone 2018.0.1 (downloaded the LTS version from your website today), running on Java 13, trying to load a plugin compiled with --release 11

Jannyboy11 avatar Mar 10 '20 21:03 Jannyboy11

The LTS version will not have these changes that fixes this issue.

mastercoms avatar Mar 10 '20 21:03 mastercoms

It's not really long-term support then, is it? Which version should I be using instead? I tried with version 2018.9.0 and the 'latest build', both also downloaded from https://glowstone.net/#downloads, but both have the same issue.

Jannyboy11 avatar Mar 10 '20 21:03 Jannyboy11

No, we currently don't have the development time to maintain the LTS branch, so its been paused. Did you try this one? https://repo.glowstone.net/repository/snapshots/net/glowstone/glowstone/2018.10.0-SNAPSHOT/glowstone-2018.10.0-20200302.035422-5.jar

mastercoms avatar Mar 10 '20 21:03 mastercoms

Yes, still the same issue.

C:\Users\Test\Minecraft\Servers\Glowstone-1.12.2>java -jar glowstone-2018.10.0-20200302.035422-5.jar
22:36:32 [INFO] This server is running Glowstone version 2018.10.0-SNAPSHOT.83df5ad (MC: 1.12.2) (Implementing API version 1.12.2-R6.0-SNAPSHOT)
22:36:33 [INFO] Recipes: 307 shaped, 63 shapeless, 26 furnace, 10 dynamic, 44 fuels.
>
22:36:33 [INFO] Scanning plugins...
22:36:33 [SEVERE] Error during server startup.
java.lang.IllegalArgumentException: Unsupported class file major version 55
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:148)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:136)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:237)
        at net.glowstone.GlowPluginTypeDetector.scanFile(GlowPluginTypeDetector.java:94)
        at net.glowstone.GlowPluginTypeDetector.scan(GlowPluginTypeDetector.java:45)
        at net.glowstone.GlowServer.loadPlugins(GlowServer.java:1239)
        at net.glowstone.GlowServer.start(GlowServer.java:770)
        at net.glowstone.GlowServer.run(GlowServer.java:625)
        at net.glowstone.GlowServer.main(GlowServer.java:489)
>
C:\Users\Test\Minecraft\Servers\Glowstone-1.12.2>

Jannyboy11 avatar Mar 10 '20 21:03 Jannyboy11

Seems like we will have to update ASM again for Java 11.

mastercoms avatar Mar 10 '20 21:03 mastercoms

Alright, thanks a lot! While you're at it, can I just remind you friendly that updating the dependency version is not enough, you also need to update the asm api version for ClassVisitors to Opcodes.ASM7. I experienced this issue on Spigot when Java 11 was released: https://hub.spigotmc.org/jira/browse/SPIGOT-4398

Jannyboy11 avatar Mar 10 '20 21:03 Jannyboy11

@mastercoms could we change the issue title to something more descriptive? Like "ASM library needs update for every JDK release"

VaiTon avatar Jul 15 '21 00:07 VaiTon