HyperConomy

HyperConomy

78.3k Downloads

NPE in DatabaseUpdater on load

phipla opened this issue ยท 6 comments

commented

Hi, RegalOwl, thanks for this plugin and for your time!

When using v0.975.1 on Spigot 1.8.1, Hyperconomy throws the following exception when loading.

We use a MySQL database for Hyperconomy. Our server is quite old, and has used a lot of versions of Hyperconomy through time, so it might be some corner-case of an old version not being properly migrated to the new table format.

[08:21:23 WARN]: Exception in thread "Thread-28"
[08:21:23 WARN]: java.lang.NullPointerException
[08:21:23 WARN]:        at regalowl.hyperconomy.inventory.HItemStack.serialize(HItemStack.java:59)
[08:21:23 WARN]:        at regalowl.hyperconomy.util.DatabaseUpdater.updateTables(DatabaseUpdater.java:94)
[08:21:23 WARN]:        at regalowl.hyperconomy.DataManager.loadEconomies(DataManager.java:137)
[08:21:23 WARN]:        at regalowl.hyperconomy.DataManager.access$000(DataManager.java:29)
[08:21:23 WARN]:        at regalowl.hyperconomy.DataManager$1.run(DataManager.java:89)
[08:21:23 WARN]:        at java.lang.Thread.run(Thread.java:745)
commented

Due to the large number of changes I've made I've had to remove support for upgrading older versions several times. Check this page for the upgrade path. If you're running something much older than version .971 it's possible that .971 won't even upgrade properly. I don't think the database existed too much before that though. To upgrade basically just run each build (as necessary) and then shut down the server and run the next one.

Let me know if that helps. If not I could take a look at your database and see if I could help out.

commented

Thank you.

I was away for a while, and did not see your reply. I'll try to do it now -- not sure it will work, though, because .974.57, the intermediate version I need for the intermediate update, does not support Spigot 1.8, and my server is already upgraded.

I'll keep you informed.

commented

I tried to update to .974.57, then to restart, and to update .975.2. Suprisingly, .974.57 seems to load alright with my 1.8 server (does not work properly, I cannot buy or sell anything), but .975.2 still throws the same error.

commented

We were originally running .974.2, which was the version we were using since we upgraded to 1.7 (our server is using Hyperconomy since November 2012, the first version of HC was .953, and there have been no economy resets)

We finally managed to get it working, by :

  • with .974.57: exporting the database to CSV, deleting the tables, having them re-created again, importing the database from CSV (it fixes the structure of the table, because DATA was an int on our database, not a TEXT. This operation required entering manual commands, though, because for some reason, it tried to fill a "MATERIAL" column that did not exist in the newly-created database)
  • patching Hyperconomy (latest -dev) so that there the database conversion does not trigger a NPE
  • re-writing a lot of the "DATA" column, which Hyperconomy (.975.2+patch) did not re-create properly (material set to AIR, data, maxstack, and others to 0)

It finally works, but the solution sure is a bit hackish. We have made CSV backups of the database, which I can send to you if you want to investigate)

commented

I'm guessing the upgrade partially ran. Which build were you using successfully before upgrading? You could try resetting the database version in the hyperconomy_settings table so that the upgrade tries to run again. .974.57 can upgrade from version 1.23 onward. Let me know which build you were on previously and I can figure out which version to set your database to. Also, if you'd rather, I could just take a look at your database to figure it out. The database can be exported to CSV with /hcdata exportcsv all. It might be easier to just use phpMyAdmin with MySQL though.

commented

.953 needed the .971 update if not also an earlier one before running .974.57. Glad you got it working. In the future this shouldn't happen. HyperConomy will instead fail to run and will no longer change the database if it detects an incompatible upgrade path.

If you'd like I could probably update the database cleanly and return it to you if you send me the backups. .953 depended heavily on the .yml files so those might also be needed if you want to migrate that data forward. If there is a build needed before .971 I'll update the compatibility chart. Some of the older builds didn't have a good version system so I'm not entirely sure it's complete.