5

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 :)

Adalberto
  • 75
  • 1
  • 5
  • `java.time` is available for Java >= 8, so a silly question: what version are you using? –  Aug 03 '17 at 19:40
  • 1
    jre1.8.0_131 on the on-premise server and locally, thanks for helping. – Adalberto Aug 03 '17 at 19:47
  • 1
    Don't know if it will make a difference, but try using the JDK, not JRE. – Dan W Aug 03 '17 at 21:18
  • 1
    Thank you @DanW I will try, the person in charge of the server is out and will be back in a week... hopefully that's the solution. Will let you know if works to upvote you – Adalberto Aug 04 '17 at 20:12
  • 1
    I rebound on @Hugo comment, `java.time.zone.ZoneRulesProvider` is included in Java SE 8. Maybe Java JRE 8 is installed on your on-premise machine, but the Mule Runtime is using another version (such as JRE 7)? (you can check with `update-java-alternatives -l` ) – Pierre B. Aug 05 '17 at 15:50
  • 2
    Apparently it was an issue with the server environment, probably the environment variables where not pointing to the right place, don't know for sure but after we talk about it the person in charge fixed the problem. Hello @DanW Can you please write your answer so I can mark it as the best answer, thank you guys for the help. – Adalberto Sep 04 '17 at 14:53
  • 1
    Hi @Adalberto. I think I'm having the same problem. I recently modified my program and I used for the first time the ZonedDateTime class. I get the exact same error i.e. "Could not initialize class java.time.zone.ZoneRulesProvider". Obvioulsy everything works perfectly on my development machine and also in an internal production/test machine but when I deploy the application on a extern production server I get the error. Could you possibly explain what do you mean with "he environment variables where not pointing to the right place"? How the person in charge you referred to fixed the problem? – Magallo Sep 10 '19 at 12:27

1 Answers1

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.

Dan W
  • 5,718
  • 4
  • 33
  • 44