Jump to content

[Solved] [1.12] "NoClassDefFoundError" when launching Server


Recommended Posts

Posted (edited)

Hello everybody,

I recently started making a small Mod for me and a friend which we can use on our server.

So far everything is working out well when I test the Mod in an Single-Player environment, but when i started it as a Server, i got a crash and a NoClassDefFoundError referencing the ICustomModelLoader class.

I know that this class is "Single-Player-only" so im wondering where exactly the Server tries to acces it. I looked through my code but couldnt exactly figure out where, I also googled for similar errors but havent found one close to this and thus didnt find good advice. I also think that i didnt use any !world.isRemote() so far, could it possibly be an error with this? I wanted to implement those later, but to be honest, i dont even exactly know when and when not i have to do this.

The error message im getting is rather long as well, so I dont know wether I only have one error, which is causing all the others, or wether I have multiple ones I have to fix.

  Reveal hidden contents

If you want to check my source code you can do this here.

If some code is familiar for you, this is propably because I just plainly copied a bit of tutorials, but like I said, I dont want to make a big mod or something, just for me and a friend.

Any help and advice is welcomed.

Thank you in advance,  AleMax

Edited by AleMax
Posted

- Check your common proxy for that import

- Make sure a common class does not access a method statically of a class which imports client only stuff

 

These are cases that can happen quickly and without intention (through human error or sometimes when IDEs do stuff) and I have seen them a couple of times already.

  • Like 1
Posted
  On 8/22/2018 at 4:50 PM, diesieben07 said:

Imports are entirely irrelevant. Imports are a compiler fiction.

 

@AleMax All access to client-only classes must be encapsulated through your client proxy. For example: Your ItemTest class directly references ModelLoader. Since your ItemTest class will also be loaded on the server, this will crash.

 Moreover: Code style, issue 1.

Expand  

Thank you for the help!

I went through my classes and checked for any client-only classes, and then put those in the proxy classes directly (and deleted this nonuse test item lol)

The error log is now basicly reduced to half, but i still got the same error just with the IStateMapper class.

  Reveal hidden contents

The only classes which use any client only classes are the model and render classes now, should i remove them from there as well, I think that could get a bit difficult or am I doing something fundamentally wrong?

I already saw the thing with the common proxy befor posting, i will probably change it after i got this error fixed ?

I updated my Source code if you want to take a look at it. 

Posted

 

  On 8/22/2018 at 5:45 PM, diesieben07 said:

You have registered your ClientProxy class with @EventBusSubscriber without specifying a side. This effectively makes your client proxy run on a dedicated server as well. I hope you understand why this is a bad idea.

Expand  

Incredible. Thank you! Everything is working now.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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