Bassebombecraft

Bassebombecraft

18.5k Downloads

Server Crash

Closed this issue · 19 comments

commented

Minecraft v1.15.2
Forge v31.1.35
BasseBombeCraft v1.41

The mod crashes server side as soon as it tries to load a world.
Crash Log

commented

The stack trace indicate an failed attempt to load the class:
java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient

Release 1.42 will include the solution named "Shading, using com.github.johnrengelman.shadow" below.

Refactor HTTP client

One long term solution is to refactor the mod to eliminate the usage of the Apache HTTPClient libray. See:
http://magnus-k-karlsson.blogspot.com/2019/09/http-client-in-java-8-httpurlconnection.html

Shading, using forge

Another solution is to use shading in Forge, see:
https://stackoverflow.com/questions/36659980/java-jar-classnotfoundexception-even-though-dependent-library-exists/41629406#41629406
https://forgegradle.readthedocs.io/en/latest/user-guide/shading/
https://forgegradle.readthedocs.io/en/latest/cookbook/
Implemented shading:

// Define repositories to support shading of 3. party libraries½
repositories {
	mavenCentral()
	jcenter()
}

// Define shading of 3rd party libaries.
// https://forgegradle.readthedocs.io/en/latest/cookbook/
configurations {
    shade
    compile.extendsFrom shade
}

dependencies {
    ...
    // define shaded 3rd party libraries
    shade 'org.apache.httpcomponents:httpclient:4.3.3'
    shade 'org.apache.httpcomponents:httpcore:4.3.2'                
}

jar {
    ....
    // collect and add shaded 3rd party libraries to the jar
    configurations.shade.each {
        from (project.zipTree(it)) {
            exclude 'META-INF/MANIFEST.MF'
        }
    }	    
}   

But it didn't work because classes form org.apache can't be loaded by mods.
See: https://www.minecraftforge.net/forum/topic/74746-need-orgapachecommonscollections4-library-in-mod/

Attempt to repackage the org.apache libraries also failed since support for the srgExtra command that feature has been removed from the plugin:
https://www.minecraftforge.net/forum/topic/63896-1122-noclassdeffounderror/

Shading, using com.github.johnrengelman.shadow

https://www.minecraftforge.net/forum/topic/37951-using-apache-commons-math-in-my-mod/
https://github.com/Darkere/CrashUtilities/blob/e2dd0a3cd6d82547d8d93754a101f00ab889110e/build.gradle
https://github.com/schematical/chaoscraft-mod/blob/cbbf0785c6fac62636f842398128556ca4f9f580/build.gradle
https://github.com/satyrnidae/wolfarmor/blob/9b8189547ad1db0b2e6458d13acf50047e736ca8/build.gradle

Embed libraries

Another solution is to embed the libraries using Forge, see:
https://mcforge.readthedocs.io/en/latest/gettingstarted/dependencymanagement/
https://www.minecraftforge.net/forum/topic/71502-1122-library-only-working-on-runserverrunclient-javalangnoclassdeffounderror/
https://www.minecraftforge.net/forum/topic/69816-classes-not-found-during-runtime/
https://github.com/GloriousAlpaca/Minecraft-Discordbot/tree/master/src/main/resources/META-INF/libraries

commented

Thanks! If I download the file, where would I save it to?

commented

Try to put the file in the same directory where the mods are (e.g. the mods directory).
(I'm not that skilled in using servers, but I will try to figure it out if it doesn't work).
But let me know if it works?

commented

Alright, I'll give it a try later today

commented

Please notice, that the instructions for the work around are getting updated above to be more detailed.

commented

Have the instructions changed above? Or is it WIP still?

commented

It is WIP: The three long solutions is under evaluation/development.

commented

Will be resolved by issue #696 as part of release 1.42.

commented

Awesome, thanks!

commented

@WenXin20: If you are interested, I have published a draft release of 1.42 that you can try out: https://github.com/athrane/bassebombecraft/releases/tag/1.42.1-RC1

You should download the jar file ending with -server.jar : https://github.com/athrane/bassebombecraft/releases/download/1.42.1-RC1/BasseBombeCraft-1.15.2-1.42-server.jar which resolves this particular issue. But issue #700 is still unresolved and WIP.

commented

Thanks!
Is #700 saying that if another player joins, it could crash at its current state of the mod?

commented

#700 is saying: if the Potion of Mob Respawning is active on a mob and the mob dies, then the potion logic will assume that mod is running in a client setup (i.e. when you start Minecraft locally on your PC and NOT as a server). In a client setup there is always a single player. The logic must be changed to making no assumptions about the number of players. The workaround for now is to avoid using the Potion of Mob Respawning.

To answer your question, as long as the potion isn't used, then the you should fine. And any number of players should be able to join.

commented

I see, thanks!

commented

Resolved with #696.

commented

@WenXin20
1.42 has been released.
This should include a fix for this bug and other server related bugs.
It can be found here: https://github.com/athrane/bassebombecraft/releases
Curse will also be updated in a short while.
Please try it out and let me know.

commented

Unfortunately, I got another server crash after trying out v1.42 from curseforge.
https://gist.github.com/WenXin20/13f006631a8559d9975ba412c4ccb2ea

commented

@WenXin20
I thank you for your patience. I will look into it asap.

commented

It's no problem! I appreciate all your help!

commented

I have opened an issue with the new error in #708.