November 08, 2018

Fail to initialize due to unknown Zone Id while running springboot application


Fail to initialize due to unknown Zone Id while running springboot application:

> Errors while running application:

- Application startup failed java.time.zone.ZoneRulesException: Unknown time-zone ID: America/Fort_Nelson

- Caused by: java.time.zone.ZoneRulesException: Unknown time-zone ID: America/Fort_Nelson
at java.time.zone.ZoneRulesProvider.getProvider(ZoneRulesProvider.java:272)
at java.time.zone.ZoneRulesProvider.getRules(ZoneRulesProvider.java:227)
at java.time.ZoneRegion.ofId(ZoneRegion.java:120)


> For using the latest version of Timeshape, the 2018d.3 or 2018d.4: We are facing this issue,



net.iakovlev
timeshape
2018d.5


> After so much analysis, released 2018d.5 where this change is merged and working fine with out any issues.

For applicaiton instalization:

@Component
public class AppStartUpConfig implements ApplicationListener {
@Autowired
TimeZone timeZone;
@Override
public void onApplicationEvent(ApplicationReadyEvent arg0) {
timeZone.setTimeZoneEngine(TimeZoneEngine.initialize());
}
}

In dto:
@GeoSpatialIndexed
private Point geoCoordinates;

For actual usage class:
@Autowired
TimeZone timeZoneEngine;

To get the geoCoordinates:
Optional zoneId = timeZoneEngine.getTimeZoneEngine().query(
geoCoordinates.getY(),
geoCoordinates.getX());
String timezoneId = zoneId.get().getId();


Reference:
https://github.com/RomanIakovlev/timeshape/issues/12

No comments:

Post a Comment

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

My Favorite Site's List

#update below script more than 500 posts