this is my first post , apologies if I miss anything describing the issue.

I am in the process of upgrading application from Spring 4.2.1.Final(Hibernate 4.2.18.Final) to Spring 5.3.29(Hibernate 5.2.15.Final). The project uses Spring MVC, Java 8(currently) with frontend and backend decoupled and I have two IBM Liberty servers one each. I am facing this issue when I am running the server.

Caused by: java.lang.NoSuchMethodError: javax/validation/Configuration.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider

  1. I used jakarta validation jar and hibernate instead of javax.validation 1.0.0.GA, still facing same error

        <dependency>
         <groupId>jakarta.validation</groupId>
         <artifactId>jakarta.validation-api</artifactId>
         <version>3.0.2</version>
        </dependency>
        <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-validator</artifactId>
         <version>4.3.1.Final</version>
        </dependency>
    
  2. I experimented with few other jars as per stackoverflow and other online suggestions, but still facing same error .

  3. I followed this post Websphere 8.5 with Spring-5 and upgraded dependencies to below in pom.xml

            <dependency>
             <groupId>javax.validation</groupId>
             <artifactId>validation-api</artifactId>
             <version>1.1.0.Final</version>
             <type>jar</type>
             <scope>compile</scope>
           </dependency>
           <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-validator</artifactId>
             <version>5.1.3.Final</version>
           </dependency>
    

I couldn't locate the file deployment.xml or similar in IBM Liberty to edit as per above suggestion. If I use above I am getting below error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'refDataLoader' defined in ServletContext resource [/WEB-INF/project-portlet-beans.xml]: Invocation of init method failed; nested exception is com.thoughtworks.xstream.io.StreamException: 2024-02-05T13:28:25,309 DEBUG (LargeThreadPool-thread-49) [EhCacheManagerFactoryBean(Shutting down EhCache CacheManager:)] Shutting down EhCache CacheManager

Does anyone know which file to edit in Liberty folder for step 3 above or what I can do to fix javax/validation error . Thanks in advance , any help is greatly appreciated.

1

There are 1 best solutions below

0
Alasdair On

You are trying to use the Jakarta EE 9 version of validation and Spring Framework 5 needs the Jakarta EE 8 version. Your api dependency should be:

<dependency>
    <groupId>jakarta.validation</groupId>
    <artifactId>jakarta.validation-api</artifactId>
    <version>2.0.2</version>
</dependency>

I think you also will need to increase the Hibernate Validator dependency to 6.2 for the Jakarta EE 8 version.

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>4.3.1.Final</version>
</dependency>