Could not initialize class com.mrcrayfish.framework.platform.Services
legopitstop opened this issue ยท 2 comments
Describe the bug
Game crashes in a development environment with Framework and MrCrayfish's Furniture Mod: Refurbished on Fabric
Steps To Reproduce
- Download example fabric mod. https://github.com/FabricMC/fabric-example-mod
- Add dependencies to build.gradle (Using cursemaven)
repositories {
maven {
url "https://cursemaven.com"
}
}
dependencies {
modImplementation "curse.maven:framework-549225:5692391" // framework-fabric-1.21.1-0.9.2.jar
modImplementation "curse.maven:refurbished-furniture-897116:5705549" // refurbished_furniture-fabric-1.21.1-1.0.6.jar
}
- Now, run 'Minecraft Client'
- Game crashes before minecraft loads.
Expected behavior
The game successfully builds and runs in a development environment.
Versions
- framework: 1.21.1-0.9.2
- refurbished: 1.21.1-1.0.6
- fabric API: 0.105.0+1.21.1
- loader: 0.16.5
- minecraft: 1.21.1
Additional Details
crash-2024-09-28_17.20.04-client.txt
---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3
Time: 2024-09-28 17:20:04
Description: Initializing game
java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'framework' at 'com.mrcrayfish.framework.FrameworkFabric'!
at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:403)
at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33)
at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:401)
at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52)
at net.minecraft.client.MinecraftClient.<init>(MinecraftClient.java:477)
at net.minecraft.client.main.Main.main(Main.java:239)
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480)
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
Suppressed: java.lang.NoClassDefFoundError: Could not initialize class com.mrcrayfish.framework.platform.Services
at com.mrcrayfish.framework.Registration.init(Registration.java:51)
at com.mrcrayfish.framework.FrameworkSetup.run(FrameworkSetup.java:31)
at com.mrcrayfish.furniture.refurbished.FurnitureMod.onInitialize(FurnitureMod.java:130)
at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:399)
... 7 more
Caused by: java.lang.ExceptionInInitializerError: Exception java.util.ServiceConfigurationError: com.mrcrayfish.framework.platform.services.IRegistrationHelper: com.mrcrayfish.framework.platform.FabricRegistrationHelper Unable to get public no-arg constructor [in thread "Render thread"]
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:679)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1240)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
at java.base/java.util.ServiceLoader.findFirst(ServiceLoader.java:1812)
at com.mrcrayfish.framework.platform.Services.load(Services.java:22)
at com.mrcrayfish.framework.platform.Services.<clinit>(Services.java:16)
at com.mrcrayfish.framework.Registration.init(Registration.java:51)
at com.mrcrayfish.framework.FrameworkSetup.run(FrameworkSetup.java:31)
at com.mrcrayfish.framework.FrameworkFabric.<init>(FrameworkFabric.java:13)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at net.fabricmc.loader.impl.util.DefaultLanguageAdapter.create(DefaultLanguageAdapter.java:58)
at net.fabricmc.loader.impl.entrypoint.EntrypointStorage$NewEntry.getOrCreate(EntrypointStorage.java:124)
at net.fabricmc.loader.impl.entrypoint.EntrypointContainerImpl.getEntrypoint(EntrypointContainerImpl.java:53)
... 8 more
Caused by: net.fabricmc.loader.api.EntrypointException: Exception while loading entries for entrypoint 'main' provided by 'framework'
at net.fabricmc.loader.impl.entrypoint.EntrypointContainerImpl.getEntrypoint(EntrypointContainerImpl.java:56)
at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:399)
... 7 more
Caused by: net.fabricmc.loader.api.LanguageAdapterException: java.lang.reflect.InvocationTargetException
at net.fabricmc.loader.impl.util.DefaultLanguageAdapter.create(DefaultLanguageAdapter.java:60)
at net.fabricmc.loader.impl.entrypoint.EntrypointStorage$NewEntry.getOrCreate(EntrypointStorage.java:124)
at net.fabricmc.loader.impl.entrypoint.EntrypointContainerImpl.getEntrypoint(EntrypointContainerImpl.java:53)
... 8 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at net.fabricmc.loader.impl.util.DefaultLanguageAdapter.create(DefaultLanguageAdapter.java:58)
... 10 more
Caused by: java.util.ServiceConfigurationError: com.mrcrayfish.framework.platform.services.IRegistrationHelper: com.mrcrayfish.framework.platform.FabricRegistrationHelper Unable to get public no-arg constructor
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:679)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1240)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
at java.base/java.util.ServiceLoader.findFirst(ServiceLoader.java:1812)
at com.mrcrayfish.framework.platform.Services.load(Services.java:22)
at com.mrcrayfish.framework.platform.Services.<clinit>(Services.java:16)
at com.mrcrayfish.framework.Registration.init(Registration.java:51)
at com.mrcrayfish.framework.FrameworkSetup.run(FrameworkSetup.java:31)
at com.mrcrayfish.framework.FrameworkFabric.<init>(FrameworkFabric.java:13)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
... 13 more
Caused by: java.lang.NoClassDefFoundError: org/reflections/Configuration
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3549)
at java.base/java.lang.Class.getConstructor0(Class.java:3754)
at java.base/java.lang.Class.getConstructor(Class.java:2442)
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:666)
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:663)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:674)
... 24 more
Caused by: java.lang.ClassNotFoundException: org.reflections.Configuration
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:226)
at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:119)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
... 32 more
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Render thread
Stacktrace:
at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:403)
at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33)
at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:401)
at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52)
at net.minecraft.client.MinecraftClient.<init>(MinecraftClient.java:477)
The release artifact contains JiJ dependencies, which when you put back into a development environment, won't load them. You will need to switch to using GitHub Packages as the POM will contain the dependencies needed to build the mod.
repositories {
maven {
name = "MrCrayfish (GitHub)"
url = "https://maven.pkg.github.com/MrCrayfish/Maven"
credentials {
username = findProperty("gpr.user")
password = findProperty("gpr.key")
}
}
}
dependencies {
modImplementation "com.mrcrayfish:framework-fabric:${minecraft_version}-${framework_version}"
modImplementation "com.mrcrayfish:refurbished_furniture-fabric:${minecraft_version}-${furniture_version}"
}
However in order to access GitHub Packages, you will need to authenticate yourself. gpr.user
is just your GitHub username, and gpr.key
is a Tokens (classic) which is generated here: https://github.com/settings/tokens. These should be defined in gradle.properties
which is located in your Gradle User Home directory as to avoid publishing them into a version control.