简体   繁体   中英

Joda-time MissingResourceException

I'm getting a

java.util.MissingResourceException: Can't find bundle for base name org.joda.time.format.messages, locale en

in the following piece of code;

    DateTime start = new DateTime();
    DateTime end = new DateTime(2017, 3, 26, 12, 0, 0, 0);
    Interval interval = new Interval(start, end);


    Period period = interval.toPeriod();

    // This line is causing the exception.
    System.out.println(PeriodFormat.getDefault().print(period));

Relevant part of the stack trace:

Caused by: java.util.MissingResourceException: Can't find bundle for base name org.joda.time.format.messages, locale en
    at java.util.ResourceBundle.throwMissingResourceException(Unknown Source) ~[?:1.8.0_65]
    at java.util.ResourceBundle.getBundleImpl(Unknown Source) ~[?:1.8.0_65]
    at java.util.ResourceBundle.getBundle(Unknown Source) ~[?:1.8.0_65]
    at org.joda.time.format.PeriodFormat.buildWordBased(PeriodFormat.java:217) ~[?:?]
    at org.joda.time.format.PeriodFormat.wordBased(PeriodFormat.java:205) ~[?:?]
    at org.joda.time.format.PeriodFormat.getDefault(PeriodFormat.java:73) ~[?:?]

I'm using Joda Time 2.9.2 and Intellij IDEA 15.0.1 with mainly Maven

The module

I think it is fixed now.. Yesterday it appeared to happen after reloading the bukkit/spigot (Minecraft) server this plugin was running on. It would work fine when restarting the server, but a reload would break it. But today it just all seems to work fine. Strange, no idea what caused it.

EDIT: It appears a bukkit server just doesn't handle resource bundles when reloading well at all. One reload just breaks everything wich uses resource bundles.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM