Posted February 7, 20187 yr I'm currently making a mod that uses discord jda, but I'm running into some issues when running the mod. When I run it through eclipse, it works just fine - no problems at all. When I run gradlew build, export it with all the dependency jars in the libs folder (picture below), and then run minecraft, it gives me this: [19:03:17] [Client thread/ERROR]: Caught exception from laggview java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at net.dv8tion.jda.core.utils.JDALogger.<clinit>(JDALogger.java:52) ~[JDALogger.class:?] at net.dv8tion.jda.core.entities.impl.JDAImpl.<clinit>(JDAImpl.java:58) ~[JDAImpl.class:?] at net.dv8tion.jda.core.JDABuilder.buildAsync(JDABuilder.java:643) ~[JDABuilder.class:?] at net.dv8tion.jda.core.JDABuilder.buildBlocking(JDABuilder.java:701) ~[JDABuilder.class:?] at net.dv8tion.jda.core.JDABuilder.buildBlocking(JDABuilder.java:730) ~[JDABuilder.class:?] at com.thelagg.laggview.DiscordListener.<init>(DiscordListener.java:41) ~[DiscordListener.class:?] at com.thelagg.laggview.LaggView.init(LaggView.java:75) ~[LaggView.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25] at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:560) ~[forge-1.8.9-11.15.1.2318-1.8.9.jar:?] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211) ~[forge-1.8.9-11.15.1.2318-1.8.9.jar:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189) ~[forge-1.8.9-11.15.1.2318-1.8.9.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?] at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:737) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:310) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:495) [ave.class:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:329) [ave.class:?] at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:101) ~[launchwrapper-1.12.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_25] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_25] ... 43 more My Dependencies: I've also tried adding the JDA to my build.gradle by adding: repositories { jcenter() } dependencies { compile 'net.dv8tion:JDA:3.5.0_327' } But that gave me the same error, so I commented that out for now. I think it should work properly because when I look inside the jar with WinRAR, it shows me that org.slf4j.LoggerFactory exists: I'm thinking I must be doing something wrong with exporting the mod because it runs fine from eclipse - it just doesn't run when I put it in my .minecraft/mods folder. I'd appreciate any help, thanks in advance! P.S. I'm using Forge 1.8.9 latest version - I'm not sure if that's a problem. The reason I'm using that over 1.11 is because the server my mod's designed for runs only 1.8.9. Hi
February 7, 20187 yr Author 1 hour ago, loordgek said: http://imperceptiblethoughts.com/shadow/ I don't quite understand what you mean by this, am I supposed to use shadow to insert org.slf4j into the existing jar? I've already looked at the jar from inside winrar and org.slf4j seems to be there - it just doesn't seem to be compiled at runtime. Could you explain a bit more? Edited February 7, 20187 yr by Lagg Hi
February 7, 20187 yr Author 13 minutes ago, loordgek said: you need to shadow org.slf4 into your jar can you post your mod jar here http://www.mediafire.com/file/wzu11q1wcrahag4/laggview-1.0.jar Hi
February 9, 20187 yr Author Ok so I've done a bit more stuff with the gradle shadow plugin @loordgek posted, but now I have an issue with minecraft obfuscation. When I run gradlew build with this in my build.gradle: buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2' } } apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'com.github.johnrengelman.plugin-shadow' apply plugin: 'java' version = "1.0" group= "com.thelagg.laggview" archivesBaseName = "laggview" sourceCompatibility = 1.8 targetCompatibility = 1.8 project.tasks.build.dependsOn project.tasks.shadowJar minecraft { version = "1.8.9-11.15.1.2318-1.8.9" runDir = "run" mappings = "stable_20" } shadowJar { baseName = 'laggview-shadow' classifier = null version = 1.0 configurations = [project.configurations.compile] } repositories { jcenter() } dependencies { //both my dependencies are in the ./libs folder } processResources { inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version from configurations.compile.collect { zipTree it } from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' expand 'version':project.version, 'mcversion':project.minecraft.version } from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } The shadow-jar seems to look good when I open it with luyten (java deobfuscator): The regular jar hasn't changed at all (it still compiles the dependencies, but doesn't shadow them). I've tried putting the shadow jar into my mods folder to try and run that, but it gave me an error that it could not find a method Minecraft.getMinecraft() - the shadowed Jar doesn't obfuscate any of the fields or methods inside it (picture below) laggview-shadow-1.0.jar laggview-1.0.jar So, I'm looking to do either one of 2 things: Obfuscate the shadow jar like I would with the normal jar shadow the normal jar's dependencies I just have no idea how to do either of those things... If anybody could shed some light on the topic, I would appreciate it. Thanks! Edited February 9, 20187 yr by Lagg grammar Hi
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.