Jump to content

[1.12.2] NoClassDefFoundError


DarkEyeDragon

Recommended Posts

So after trying to solve this issue for a couple of hours now i have no idea's on what to do to fix this.

 

My mod depends on 2 apache libs "fluent-hc" and "httpmime"

 

they get included in my mod jar. but still somehow cant be loaded when asked to. Is there any special procedure i need to go trough for them to load properly?

 

my current build.gradle:

 

configurations {
    shade
    compile.extendsFrom shade
}
buildscript {
    repositories {
        jcenter()
        maven { url = "http://files.minecraftforge.net/maven" }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

version = "1.1.0"
group = "com.darkeyedragon.screenshotuploader" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ScreenshotUploader"

sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
    sourceCompatibility = targetCompatibility = '1.8'
}

minecraft {
    version = "1.12.2-14.23.2.2611"
    runDir = "run"

    // the mappings can be changed at any time, and must be in the following format.
    // snapshot_YYYYMMDD   snapshot are built nightly.
    // stable_#            stables are built at the discretion of the MCP team.
    // Use non-default mappings at your own risk. they may not always work.
    // simply re-run your setup task after changing the mappings to update your workspace.
    mappings = "snapshot_20171003"
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

dependencies {
    shade group: 'org.apache.httpcomponents', name: 'fluent-hc', version: '4.5.5'
    shade group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.1'
}

processResources {
    // this will ensure that this task is redone when the versions change.
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    // replace stuff in mcmod.info, nothing else
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
                
        // replace version and mcversion
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }
        
    // copy everything else except the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}
jar {
    configurations.shade.each { dep ->
        from(project.zipTree(dep)){
            exclude 'META-INF', 'META-INF/**'
        }
    }
}

i've tried using shadowjar, no luck. 

 

Error

[17:07:05] [Custom Image Uploading/INFO] [STDOUT]: [com.darkeyedragon.screenshotuploader.client.imageuploaders.CustomUploader:lambda$uploadImage$0:45]: SCREENSHOTLOGGER: 1
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDOUT]: [com.darkeyedragon.screenshotuploader.client.imageuploaders.CustomUploader:lambda$uploadImage$0:47]: SCREENSHOTLOGGER: 2
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDOUT]: [com.darkeyedragon.screenshotuploader.client.imageuploaders.CustomUploader:lambda$uploadImage$0:49]: SCREENSHOTLOGGER: 3
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDOUT]: [com.darkeyedragon.screenshotuploader.client.imageuploaders.CustomUploader:lambda$uploadImage$0:51]: SCREENSHOTLOGGER: 4
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDOUT]: [com.darkeyedragon.screenshotuploader.client.imageuploaders.CustomUploader:lambda$uploadImage$0:53]: SCREENSHOTLOGGER: 5
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDOUT]: [com.darkeyedragon.screenshotuploader.client.imageuploaders.CustomUploader:lambda$uploadImage$0:55]: SCREENSHOTLOGGER: 6
19:07:05gameinfoException in thread "Custom Image Uploading" [17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.NoClassDefFoundError: org/apache/http/entity/mime/MultipartEntityBuilder
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at com.darkeyedragon.screenshotuploader.client.imageuploaders.CustomUploader.lambda$uploadImage$0(CustomUploader.java:56)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at com.darkeyedragon.screenshotuploader.client.imageuploaders.CustomUploader$$Lambda$157/2147095642.run(Unknown Source)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at java.lang.Thread.run(Thread.java:745)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: Caused by: java.lang.ClassNotFoundException: org.apache.http.entity.mime.MultipartEntityBuilder
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.security.AccessController.doPrivileged(Native Method)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:106)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
19:07:05gameinfo[17:07:05] [Custom Image Uploading/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: ... 5 more

 

Link to comment
Share on other sites

1 minute ago, diesieben07 said:

Classes in a mod cannot be in any "org.apache" package. You must repackage the code you are shading.

minecraft {
   srgExtra "PK: org/apache/httpcomponents com/darkeyedragon/screenshotuploader/client/org/apache/httpcomponents"
}

I am assuming you're talking about this? However i tried to add them and i just got errors:

Could not find method srgExtra() for arguments [PK: org/pache/httpcomponents com/darkeyedragon/screenshotuploader/client/org/pache/httpcomponents] on object of type net.minecraftforge.gradle.user.patcherUser.forge.ForgeExtension.


 

Link to comment
Share on other sites

  • 2 years later...
On 4/6/2018 at 5:42 PM, diesieben07 said:

use the reobf task directly

Please can you provide an example of how to use the reobf task directly? Scouring the internet and there's only info on repacking using deprecated info.

Edited by jskidd3
Typo
Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.