java.lang.LinkageError on loading world when using Cardinal Components API
FoxSamu opened this issue ยท 4 comments
In the development environment and maybe other places, in some contexts Cardinal Components fails when loading the world because the Identifier
class is being loaded from different classloaders. It happens when using the custom.cardinal-components
configuration in fabric.mod.json
, and when using the StaticComponentInitializer
.
Depending on the world settings, upon creating a new world the game either crashes after loading the complete world, or it prints a lot of crash reports while generating the world and then hangs. Anyway, it's all the same issue:
---- Minecraft Crash Report ----
// Don't do that.
/* I did it anyway Minecraft, shut up now */
Time: 4/12/21 9:12 PM
Description: Feature placement
dev.onyxstudios.cca.internal.base.asm.StaticComponentLoadingException: Exception while registering static component factories for Splatcraft (splatcraft)
at dev.onyxstudios.cca.internal.base.asm.StaticComponentPluginBase.processInitializers(StaticComponentPluginBase.java:292)
at dev.onyxstudios.cca.internal.entity.StaticEntityComponentPlugin.init(StaticEntityComponentPlugin.java:108)
at dev.onyxstudios.cca.internal.base.LazyDispatcher.ensureInitialized(LazyDispatcher.java:46)
at dev.onyxstudios.cca.internal.entity.StaticEntityComponentPlugin.requiresStaticFactory(StaticEntityComponentPlugin.java:65)
at dev.onyxstudios.cca.internal.entity.CardinalEntityInternals.lambda$createEntityComponentContainer$3(CardinalEntityInternals.java:93)
at java.util.HashMap.computeIfAbsent(HashMap.java:1127)
at dev.onyxstudios.cca.internal.entity.CardinalEntityInternals.createEntityComponentContainer(CardinalEntityInternals.java:86)
at net.minecraft.entity.Entity.handler$bbe000$initDataTracker(Entity.java:6543)
at net.minecraft.entity.Entity.<init>(Entity.java:228)
at net.minecraft.entity.vehicle.AbstractMinecartEntity.<init>(AbstractMinecartEntity.java:76)
at net.minecraft.entity.vehicle.AbstractMinecartEntity.<init>(AbstractMinecartEntity.java:81)
at net.minecraft.entity.vehicle.StorageMinecartEntity.<init>(StorageMinecartEntity.java:46)
at net.minecraft.entity.vehicle.ChestMinecartEntity.<init>(ChestMinecartEntity.java:21)
at net.minecraft.structure.MineshaftGenerator$MineshaftCorridor.addChest(MineshaftGenerator.java:432)
at net.minecraft.structure.MineshaftGenerator$MineshaftCorridor.generate(MineshaftGenerator.java:475)
at net.minecraft.structure.StructureStart.generateStructure(StructureStart.java:78)
at net.minecraft.world.biome.Biome.method_28401(Biome.java:243)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.PrimitiveIterator$OfLong.forEachRemaining(PrimitiveIterator.java:189)
at it.unimi.dsi.fastutil.longs.LongIterator.forEachRemaining(LongIterator.java:53)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at net.minecraft.world.biome.Biome.generateFeatureStep(Biome.java:242)
at net.minecraft.world.gen.chunk.ChunkGenerator.generateFeatures(ChunkGenerator.java:219)
at net.minecraft.world.chunk.ChunkStatus.method_12151(ChunkStatus.java:217)
at net.minecraft.world.chunk.ChunkStatus.mdde5851$lambda$injectLightmapSetup$1$4(ChunkStatus.java:546)
at net.minecraft.world.chunk.ChunkStatus.runGenerationTask(ChunkStatus.java:135)
at net.minecraft.server.world.ThreadedAnvilChunkStorage.method_17225(ThreadedAnvilChunkStorage.java:539)
at com.mojang.datafixers.util.Either$Left.map(Either.java:38)
at net.minecraft.server.world.ThreadedAnvilChunkStorage.method_17224(ThreadedAnvilChunkStorage.java:536)
at java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:966)
at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:940)
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456)
at net.minecraft.server.world.ChunkTaskPrioritySystem.method_17634(ChunkTaskPrioritySystem.java:43)
at net.minecraft.util.thread.TaskExecutor.runNext(TaskExecutor.java:88)
at net.minecraft.util.thread.TaskExecutor.runWhile(TaskExecutor.java:132)
at net.minecraft.util.thread.TaskExecutor.run(TaskExecutor.java:100)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172)
Caused by: java.lang.BootstrapMethodError: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "net/minecraft/util/Identifier"
at nerdhub.cardinal.components.api.ComponentRegistry.<clinit>(ComponentRegistry.java:49)
at dev.onyxstudios.cca.api.v3.component.ComponentRegistryV3.<clinit>(ComponentRegistryV3.java:48)
at dev.onyxstudios.cca.api.v3.component.ComponentRegistry.getOrCreate(ComponentRegistry.java:75)
at com.cibernet.splatcraft.component.SplatcraftComponents.register(SplatcraftComponents.java:14)
at com.cibernet.splatcraft.component.SplatcraftComponents.<clinit>(SplatcraftComponents.java:10)
at com.cibernet.splatcraft.SplatcraftCardinalComponents.registerEntityComponentFactories(SplatcraftCardinalComponents.java:13)
at dev.onyxstudios.cca.internal.entity.StaticEntityComponentPlugin.lambda$init$1(StaticEntityComponentPlugin.java:110)
at dev.onyxstudios.cca.internal.base.asm.StaticComponentPluginBase.processInitializers(StaticComponentPluginBase.java:289)
... 50 more
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "net/minecraft/util/Identifier"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 58 more
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Worker-Main-1
Stacktrace:
at dev.onyxstudios.cca.internal.base.asm.StaticComponentPluginBase.processInitializers(StaticComponentPluginBase.java:292)
at dev.onyxstudios.cca.internal.entity.StaticEntityComponentPlugin.init(StaticEntityComponentPlugin.java:108)
at dev.onyxstudios.cca.internal.base.LazyDispatcher.ensureInitialized(LazyDispatcher.java:46)
at dev.onyxstudios.cca.internal.entity.StaticEntityComponentPlugin.requiresStaticFactory(StaticEntityComponentPlugin.java:65)
at dev.onyxstudios.cca.internal.entity.CardinalEntityInternals.lambda$createEntityComponentContainer$3(CardinalEntityInternals.java:93)
at java.util.HashMap.computeIfAbsent(HashMap.java:1127)
at dev.onyxstudios.cca.internal.entity.CardinalEntityInternals.createEntityComponentContainer(CardinalEntityInternals.java:86)
at net.minecraft.entity.Entity.handler$bbe000$initDataTracker(Entity.java:6543)
at net.minecraft.entity.Entity.<init>(Entity.java:228)
at net.minecraft.entity.vehicle.AbstractMinecartEntity.<init>(AbstractMinecartEntity.java:76)
at net.minecraft.entity.vehicle.AbstractMinecartEntity.<init>(AbstractMinecartEntity.java:81)
at net.minecraft.entity.vehicle.StorageMinecartEntity.<init>(StorageMinecartEntity.java:46)
at net.minecraft.entity.vehicle.ChestMinecartEntity.<init>(ChestMinecartEntity.java:21)
at net.minecraft.structure.MineshaftGenerator$MineshaftCorridor.addChest(MineshaftGenerator.java:432)
at net.minecraft.structure.MineshaftGenerator$MineshaftCorridor.generate(MineshaftGenerator.java:475)
at net.minecraft.structure.StructureStart.generateStructure(StructureStart.java:78)
at net.minecraft.world.biome.Biome.method_28401(Biome.java:243)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.PrimitiveIterator$OfLong.forEachRemaining(PrimitiveIterator.java:189)
at it.unimi.dsi.fastutil.longs.LongIterator.forEachRemaining(LongIterator.java:53)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
-- Feature --
Details:
Id: minecraft:mineshaft
Description: net.minecraft.world.gen.feature.MineshaftFeature@81ba0c5
Stacktrace:
at net.minecraft.world.biome.Biome.generateFeatureStep(Biome.java:242)
-- Generation --
Details:
CenterX: 5
CenterZ: -10
Seed: 1582765212570329302
Biome: net.minecraft.world.biome.Biome@5b8d0c7f
Stacktrace:
at net.minecraft.world.gen.chunk.ChunkGenerator.generateFeatures(ChunkGenerator.java:219)
at net.minecraft.world.chunk.ChunkStatus.method_12151(ChunkStatus.java:217)
at net.minecraft.world.chunk.ChunkStatus.mdde5851$lambda$injectLightmapSetup$1$4(ChunkStatus.java:546)
at net.minecraft.world.chunk.ChunkStatus.runGenerationTask(ChunkStatus.java:135)
-- Chunk to be generated --
Details:
Location: 5,-10
Position hash: -42949672955
Generator: net.minecraft.world.gen.chunk.NoiseChunkGenerator@91913b3
Stacktrace:
at net.minecraft.server.world.ThreadedAnvilChunkStorage.method_17225(ThreadedAnvilChunkStorage.java:539)
at com.mojang.datafixers.util.Either$Left.map(Either.java:38)
at net.minecraft.server.world.ThreadedAnvilChunkStorage.method_17224(ThreadedAnvilChunkStorage.java:536)
at java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:966)
at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:940)
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456)
at net.minecraft.server.world.ChunkTaskPrioritySystem.method_17634(ChunkTaskPrioritySystem.java:43)
at net.minecraft.util.thread.TaskExecutor.runNext(TaskExecutor.java:88)
at net.minecraft.util.thread.TaskExecutor.runWhile(TaskExecutor.java:132)
at net.minecraft.util.thread.TaskExecutor.run(TaskExecutor.java:100)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172)
-- System Details --
Details:
Minecraft Version: 1.16.5
Minecraft Version ID: 1.16.5
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_261, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1360287152 bytes (1297 MB) / 1779433472 bytes (1697 MB) up to 3790077952 bytes (3614 MB)
CPUs: 12
JVM Flags: 0 total;
Fabric Mods:
canvas: Canvas Renderer 1.0.1267
cardinal-components-base: Cardinal Components API (base) 2.7.13
cardinal-components-entity: Cardinal Components API (entities) 2.7.13
cardinal-components-util: Cardinal Components API (utilities) 2.7.13
chord: Chord 1.5.7+1.16.5-fabric
cloth-basic-math: Cloth Basic Math 0.5.1
cloth-client-events-v0: Cloth Client Events v0 1.0.8
cloth-config2: Cloth Config v4 4.11.18
debug: JustEnoughDebug 0.1
fabric: Fabric API 0.32.5+1.16
fabric-api-base: Fabric API Base 0.2.1+9354966b7d
fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.0.0+dc716ea17d
fabric-biome-api-v1: Fabric Biome API (v1) 3.1.1+ca58154a7d
fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.5+ca58154a7d
fabric-command-api-v1: Fabric Command API (v1) 1.1.1+351679a77d
fabric-commands-v0: Fabric Commands (v0) 0.2.2+ca58154a7d
fabric-containers-v0: Fabric Containers (v0) 0.1.11+9354966b7d
fabric-content-registries-v0: Fabric Content Registries (v0) 0.2.1+ca58154a7d
fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.1.3+ca58154a7d
fabric-dimensions-v1: fabric-dimensions-v1 2.0.6+9354966b7d
fabric-entity-events-v1: Fabric Entity Events (v1) 1.0.3+ca58154a7d
fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.4.2+ca58154a7d
fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.1+ca58154a7d
fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.6+ca58154a7d
fabric-item-api-v1: Fabric Item API (v1) 1.2.1+ca58154a7d
fabric-item-groups-v0: Fabric Item Groups (v0) 0.2.5+351679a77d
fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.4+9354966b7d
fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.1+ca58154a7d
fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 1.2.1+ca58154a7d
fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.0.2+ca58154a7d
fabric-mining-levels-v0: Fabric Mining Levels (v0) 0.1.3+ca58154a7d
fabric-models-v0: Fabric Models (v0) 0.2.1+ca58154a7d
fabric-networking-api-v1: Fabric Networking API (v1) 1.0.1+ca58154a7d
fabric-networking-blockentity-v0: Fabric Networking Block Entity (v0) 0.2.8+ca58154a7d
fabric-networking-v0: Fabric Networking (v0) 0.3.2+ca58154a7d
fabric-object-builder-api-v1: Fabric Object Builder API (v1) 1.9.4+9354966b7d
fabric-object-builders-v0: Fabric Object Builders (v0) 0.7.2+ca58154a7d
fabric-particles-v1: Fabric Particles (v1) 0.2.4+ca58154a7d
fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.7.4+ca58154a7d
fabric-renderer-api-v1: Fabric Renderer API (v1) 0.4.1+ca58154a7d
fabric-renderer-indigo: Fabric Renderer - Indigo 0.4.4+ca58154a7d
fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 2.2.1+ca58154a7d
fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.1.5+ca58154a7d
fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 0.1.13+ca58154a7d
fabric-rendering-v0: Fabric Rendering (v0) 1.1.2+ca58154a7d
fabric-rendering-v1: Fabric Rendering (v1) 1.5.1+ca58154a7d
fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.4.2+ca58154a7d
fabric-screen-api-v1: Fabric Screen API (v1) 1.0.0+c045166c7d
fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.1.5+9354966b7d
fabric-structure-api-v1: Fabric Structure API (v1) 1.1.4+ca58154a7d
fabric-tag-extensions-v0: Fabric Tag Extensions (v0) 1.1.1+ca58154a7d
fabric-textures-v0: Fabric Textures (v0) 1.0.6+ca58154a7d
fabric-tool-attribute-api-v1: Fabric Tool Attribute API (v1) 1.2.6+ca58154a7d
fabricloader: Fabric Loader 0.11.3
fermion: Fermion 2.9.218
fermion-orientation: Fermion Orientation 1.2.218
fermion-varia: Fermion Varia 2.6.218
fiber: fiber 0.23.0-2
frex: FREX 4.5.201
frex-events: FREX Events 1.3.13
geckolib3: Geckolib 3.0.26
jankson: Jankson 3.0.1+j1.2.0
java: Java HotSpot(TM) 64-Bit Server VM 8
joml-mod: JOML Mod 1.4.20
json-model-extensions: JSON Model Extensions 1.19.172
lazydfu: LazyDFU 0.1.2
lithium: Lithium 0.6.4-SNAPSHOT
minecraft: Minecraft 1.16.5
modmenu: Mod Menu v1.16.8+unknown.bd9230a
okzoomer: Ok Zoomer 4.0.1+1.16.2
phosphor: Phosphor 0.7.1-SNAPSHOT
satin: Satin 1.5.1
special-circumstances: Special Circumstances 1.8.218
splatcraft: Splatcraft 0.1.0+1.16.5-fabric
I was trying to help @andantedevs with his mod, who literally has the same environment, he had the same issue but for him it works fine now. I tried to do everything he did to fix it but it didn't work for me - that is:
- Refreshing Gradle
- Creating another world
- Removing the build, out, .idea, .gradle and run folder and reloading the project in IntelliJ
- Recloning the whole project
I'm working in IntelliJ Community Edition 2021.1, on Windows 10
I'll be honest I have no idea how this happens. It could be caused by CCA generating classes before Identifier
gets loaded by minecraft, but that really should not happen.
Hey, look, a wild bug (re)appeared! https://pastebin.com/iucgj9yG
Edit: outside the context of a mod-specific method https://pastebin.com/2envGamS
Updating to the 1.16
branch has (re)fixed the issue for me, but this seems too inconsistent currently for that to be a definite fix
Edit: literally out of the blue at random without refreshing gradle or even reopening the project, the issue is back
Edit edit: the issue is gone again!?!?!?
Updating to the
1.16
branch has (re)fixed the issue for me, but this seems too inconsistent currently for that to be a definite fix
Edit: literally out of the blue at random without refreshing gradle or even reopening the project, the issue is back
Edit edit: the issue is gone again!?!?!?
hm.. this definitely looks like some kind of race condition then