Can't launch KoLmafia with override files

Theraze

Active member
When I try to launch mafia with override files, I get the following error in a popup box:
Title: Java Virtual Machine Launcher
Text - 2 lines:
Could not find the main class: net.sourceforge.kolmafia.KoLmafia.
Program will exit.

This has happened both for me and Winterbay when testing combat ML using files I've compiled. I'm guessing the difference is somehow in how I'm compiling... but it works in all circumstances barring using data overrides. Any thoughts on where I can look to get better help info? Because java can't actually launch mafia, there's no debug log to point at the problem.
 

Rinn

Developer
Could you attach a diff that includes all your changes and the overrides?
 
Last edited:
This was happening to me for a while, and I never thought it could be linked to your changes, but I guess it makes sense since only a few of us were getting the error. I don't remember how I eventually came up with "erase and don't restore data overrides" but apparently I did that at some point because I no longer get the error. Is it only occurring for certain overrides (my guess would be something monster related, considering the nature of your contributions)? One of my mafia folders still uses a classskills override and it loads fine.
 

fronobulax

Developer
Staff member
Now that we moved - 1) What OS? 2) How are you starting/launching mafia?

As for the build hypothesis, I vaguely recall similar launch problems when something corrupted the manifest file...
 

Theraze

Active member
It's actually an item override that appears to be the issue, as it happens when mafia finds a new item and generates its 4 files based on that. It's possible that a monster may cause it, but when I fight unknown monsters, it's usually tied into new items as well.

1) Windows 7 64-bit, using various new versions of Java. Currently 1.6.0.23, has also happened on .19, .21, and .22. Missed the .20 compiler, if memory serves.
2) My 'standard' launch is my KoL.bat file, which runs KoLMafiaUpdate.exe, found in the update threads, and which downloads the latest daily build and copies it to KoLmafia-latest. It's a good way to know I'm up to date. I did try both launching it through double-clicking on the jar and by manually launching java -jar KoLmafia-latest.jar and both returned the same error. However, the java one did present the following crash-text:
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.sourceforge.kolmafia.AdventureResult.<init>(AdventureResult.java:213)
at net.sourceforge.kolmafia.objectpool.ItemPool.get(ItemPool.java:1213)
at net.sourceforge.kolmafia.RequestEditorKit.<clinit>(RequestEditorKit.java:1938)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.sourceforge.kolmafia.KoLmafia.class$(KoLmafia.java:149)
at net.sourceforge.kolmafia.KoLmafia.<clinit>(KoLmafia.java:149)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -64
at java.util.ArrayList.set(Unknown Source)
at net.sourceforge.kolmafia.utilities.IntegerArray.set(IntegerArray.java:59)
at net.sourceforge.kolmafia.persistence.ItemDatabase.readTradeItems(ItemDatabase.java:357)
at net.sourceforge.kolmafia.persistence.ItemDatabase.reset(ItemDatabase.java:276)
at net.sourceforge.kolmafia.persistence.ItemDatabase.<clinit>(ItemDatabase.java:255)
... 7 more
Could not find the main class: net.sourceforge.kolmafia.KoLmafia. Program will exit.

Addendum: The item I'd marked as not existing was the old sweatpants, since every character is guaranteed to have them unless you scrap them somehow. I marked as non-existing by commenting (#) out the line for the pants in equipment, itemdescs, and tradeitems. I then commenced recompiling, copying the file over my launch file, starting mafia, logging in (generating override file), completely exiting mafia, and trying to relaunch (at which point the error above appeared). Override files should be attached now.
 

Attachments

  • overrides.zip
    242 KB · Views: 59
Last edited:

Veracity

Developer
Staff member
Look at the overridden tradeitems.txt. Is there an item with id = -64? Let's see it.

Edit: revision 8892 will print a message for items with bogus itemids and skip them. That should help with override files that have been corrupted for any reason. I'd like to see what your override file has in it so we can try to figure out how it got corrupted.
Edit: and revision 8893 will not write bogus item ids into tradeitems and itemdescs.

I still want to see your corrupted override to see what item we thought had id = -64 and, perhaps, have a clue of where we found it.
 
Last edited:

Theraze

Active member
Based on the error above, verified that the problem is actually the tradeitems.txt override. The other overrides don't cause mafia to fail launching when tradeitems has been deleted...
 

Theraze

Active member
Yeah... looks like (despite me deleting it during testing, I deleted it too late) it's the sushi to blame. The override saves the whole item array, including the dummy items I'd created. Which means the sushis come in with negative numbers, which breaks tradeitems.

I replaced my ItemDatabase with the default one for this testing, but apparently too late/after the overrides had been created. *smacks self repeatedly*

Least it's a glowing example of why the sushi patch was a bad idea. At least, as it currently stands. And indeed, it was one of my changes that caused the issue, and now I know what needs to be removed if other people are using my compiles.
 

Theraze

Active member
Yep. I expected something bad to happen immediately, but wasn't really expecting the stealth smack on override files. Gah. :) I even thought (as I said in my post above) that might have been the issue, and compiled using a completely clean ItemDatabase file... however, while my jar was clean, the overrides the prior one had made weren't, and as they were the problem...
 
Top