Mule - NoClassDefFoundError: Could not initialize

2019-07-09 04:57发布

问题:

I've been trying to solve this problem without luck, hopefully someone could help me out...

I created a DateUtil.java class which is placed within my project at: src/main/java/util/DateUtil.java

I call "convertTime" method with the invoke component and on my laptop locally everything works fine but when deployed to an on-premise server I get the following error on the logs

Root Exception stack trace:

java.lang.NoClassDefFoundError: Could not initialize class java.time.zone.ZoneRulesProvider
    at java.time.ZoneRegion.ofId(Unknown Source)
    at java.time.ZoneId.of(Unknown Source)
    at java.time.ZoneId.of(Unknown Source)
    at util.DateUtil.convertTime(DateUtil.java:25)

DateUtil.class uses the following Java Classes

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

Thanks in advance for your help :)

回答1:

As you noted in the comments, you are using jre.1.8.0_131. Please try using the JDK itself (not JRE).

JDK 1.8 Downloads.