I have a unit test that throws an exception because it eventually calls
DateTimeUtils.toZonedDateTime(cal);
Setup
We just recently started using the threeten-bp at our project.
The lib is placed at a central project and the exception is thrown from a project, that references the main project.
The exception occurs at two unit tests executed by an ant build script. I can see the threeten lib in the specified jenkins-home/workspace/Trunk/Project/build/project.jar and I can also see the DB-file in there.
Running the unit test from within Eclipse doesn't generate any exception.
The second stack trace suggests, that "Data already loaded for TZDB time-zone rules version: 2014c". The calling unit test was using a Calendar without a time zone set, so I assume the default time zone is used.
I changed the calendar to use UTC time zone and now the test is working without the exception. However, I wonder why it wouldn't be possible to use local time.
Stack traces
1st test
java.lang.NoClassDefFoundError: Could not initialize class org.threeten.bp.zone.ZoneRulesProvider
at org.threeten.bp.ZoneRegion.ofId(ZoneRegion.java:143)
at org.threeten.bp.ZoneId.of(ZoneId.java:357)
at org.threeten.bp.ZoneId.of(ZoneId.java:285)
at org.threeten.bp.DateTimeUtils.toZoneId(DateTimeUtils.java:141)
at org.threeten.bp.DateTimeUtils.toZonedDateTime(DateTimeUtils.java:103)
at ...
2nd test
java.util.ServiceConfigurationError: org.threeten.bp.zone.ZoneRulesProvider: Provider org.threeten.bp.zone.TzdbZoneRulesProvider could not be instantiated: org.threeten.bp.zone.ZoneRulesException: Unable to load TZDB time-zone rules: jar:file:/jenkins-home/workspace/Trunk/Project/build/project.jar!/org/threeten/bp/TZDB.dat
at java.util.ServiceLoader.fail(ServiceLoader.java:207)
at java.util.ServiceLoader.access$100(ServiceLoader.java:164)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:360)
at java.util.ServiceLoader$1.next(ServiceLoader.java:428)
at org.threeten.bp.zone.ZoneRulesProvider.<clinit>(ZoneRulesProvider.java:93)
at org.threeten.bp.ZoneRegion.ofId(ZoneRegion.java:143)
at org.threeten.bp.ZoneId.of(ZoneId.java:357)
at org.threeten.bp.ZoneId.of(ZoneId.java:285)
at org.threeten.bp.DateTimeUtils.toZoneId(DateTimeUtils.java:141)
at org.threeten.bp.DateTimeUtils.toZonedDateTime(DateTimeUtils.java:103)
at ...
Caused by: org.threeten.bp.zone.ZoneRulesException: Unable to load TZDB time-zone rules: jar:file:/var/lib/jenkins/workspace/Virtuelles_Kraftwerk_HEAD/WetterGUIClassic/build/weather-base.jar!/org/threeten/bp/TZDB.dat
at org.threeten.bp.zone.TzdbZoneRulesProvider.load(TzdbZoneRulesProvider.java:146)
at org.threeten.bp.zone.TzdbZoneRulesProvider.<init>(TzdbZoneRulesProvider.java:87)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:310)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:356)
Caused by: org.threeten.bp.zone.ZoneRulesException: Data already loaded for TZDB time-zone rules version: 2014c
at org.threeten.bp.zone.TzdbZoneRulesProvider.load(TzdbZoneRulesProvider.java:139)