Jump to content

Mystery: One class of my mod cannot be found in some rare cases


Recommended Posts

Posted

Hi, in my mod RFTools I have had two distinct reports that some people get a ClassNotFound exception for a class that is clearly a part of my mod. Here is one such reports:

 

Time: 12/27/14 11:45 AM

Description: There was a severe problem during mod loading that has caused the game to fail

 

cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: com/mcjty/rftools/blocks/crafter/CrafterBlockTileEntity1

at cpw.mods.fml.common.LoadController.transition(LoadController.java:162)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:515)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)

at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:480)

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:867)

at net.minecraft.client.main.Main.main(SourceFile:148)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

Caused by: java.lang.NoClassDefFoundError: com/mcjty/rftools/blocks/crafter/CrafterBlockTileEntity1

at com.mcjty.rftools.blocks.ModBlocks.initCrafterBlocks(ModBlocks.java:130)

at com.mcjty.rftools.blocks.ModBlocks.init(ModBlocks.java:75)

at com.mcjty.rftools.CommonProxy.preInit(CommonProxy.java:50)

at com.mcjty.rftools.ClientProxy.preInit(ClientProxy.java:19)

at com.mcjty.rftools.RFTools.preInit(RFTools.java:124)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)

... 10 more

Caused by: java.lang.ClassNotFoundException: com.mcjty.rftools.blocks.crafter.CrafterBlockTileEntity1

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 42 more

Caused by: java.lang.NoClassDefFoundError: com/mcjty/rftools/blocks/crafter/CrafterBlockTileEntity3

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:182)

... 44 more

Caused by: java.lang.ClassNotFoundException: com.mcjty.rftools.blocks.crafter.CrafterBlockTileEntity3

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:101)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 48 more

 

However, nearly everybody else (except for the two reports I got) has no problems with this at all. Also the report above was apparently fixed in a more recent version of my mod but the other person still has the problem.

 

The problematic class is very simple:

 

package com.mcjty.rftools.blocks.crafter;

public class CrafterBlockTileEntity1 extends CrafterBlockTileEntity3 {

    public CrafterBlockTileEntity1() {
        super();
        setSupportedRecipes(2);
    }
}

 

Code can be found here:

 

https://github.com/McJty/RFTools/tree/master/src/main/java/com/mcjty/rftools/blocks/crafter

 

I have absolutely no clue why this class cannot be found in some situations and as I cannot reproduce it myself I also have no idea how to solve this. It is as if the class is somehow removed from the class path. Anyone has any suggestions as to what could be wrong here?

 

Thanks!

 

Posted

I have seen several reasons what classes cannot be found,

the most common is that the class is only provided on one side, eg. serverside code trying to access proxyclient

since it implements ISidedInventory  this could be your problem though unlikely or it would happen more often

 

this problem could even be caused by the java version the person with the problem is using

it could also be an incompatibility with the forge version they are using

or even there installation of the mod is incorrect, even a corrupted download

 

Posted

As a workaround, you can create a new instance of CrafterBlockTileEntity3, then do setSupportedRecipes(2)

 

Well I have to give a class to registerTileEntity so I can't use that unfortunatelly.

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.