1

I receive

java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.valueextraction.ValueExtractorManager

when using JDK version 1.8.0_265 and having one or more DL4J dependencies (version 1.0.0-beta7) in my Maven dependencies in Spring Boot application. This error doesn't occur on JDK v1.8.0_272.

My application runs on Spring Boot 2.3.7.RELEASE. I checked DL4J dependencies and listed the ones that cause this exception below:

<dependency>
    <groupId>org.deeplearning4j</groupId>
    <artifactId>deeplearning4j-core</artifactId>
    <version>1.0.0-beta7</version>
</dependency>
<dependency>
    <groupId>org.deeplearning4j</groupId>
    <artifactId>arbiter-deeplearning4j</artifactId>
    <version>1.0.0-beta7</version>
</dependency>
<dependency>
    <groupId>org.deeplearning4j</groupId>
    <artifactId>deeplearning4j-ui-model</artifactId>
    <version>1.0.0-beta7</version>
</dependency>

This happens on both Linux and Windows with JDK (AdoptOpenJDK) v.1.8.265 but it works fine with JDK v1.8.272.

It's a bit critical for us to stick to 265 version and it's impossible to stop using Hibernate in the application.

Can't share full stacktrace as it's related to the project code but one of the places where this exception is throw is while instantiating javax.validation.Validation:

Validation.buildDefaultValidatorFactory().getValidator();      // this line causes NoClassDefFoundError

I ran mvn dependencies:tree and there's no Hibernate dependencies shown for the whole project so I assume the the dependencies above use old version of Hibernate that causes error because it conflicts with Hibernate from Spring but that's just an assumption because it definitely has something to do with JDK.

Is there a way to identify what exactly causes a problem and fix it without moving to new JDK?

Svetlana Guma
  • 37
  • 1
  • 7
  • After a lot of tries and failures I think I found out the reason: I built artifact (using MANIFEST) with one version - let's say 1.8.272 - and tried to run it using a different version - let's say 1.8.282. I think there's a bug that didn't allow me to build with one version and run with another. As soon as I used the same version (1.8.282) to build and run - the problem was gone. – Svetlana Guma Aug 14 '21 at 11:18

0 Answers0