I am creating a springboot program, and it was working earlier until I altered the SQL table and added a column skipMerge.
My entity class:
package com.chansoft.Entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.lang.NonNull;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "files")
@Getter
@Setter
public class FilesEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "fileID")
private Long fileID;
@Column(name = "uploaded", columnDefinition = "tinyint(1)")
@NonNull
private boolean uploaded;
@Column(name = "ocrCompleted", columnDefinition = "tinyint(1)")
@NonNull
private boolean ocrCompleted;
@Column(name = "ocrDownloaded", columnDefinition = "tinyint(1)")
@NonNull
private boolean ocrDownloaded;
@Column(name = "ocrIndexed", columnDefinition = "tinyint(1)")
@NonNull
private boolean ocrIndexed;
@Column(name = "ocrJSONFileName", columnDefinition = "json")
private String ocrJSONFileName;
@Column(name = "fileDirectory", columnDefinition = "varchar(1000)")
private String fileDirectory;
@Column(name = "gcsDirectory", columnDefinition = "varchar(1000)")
private String gcsDirectory;
@Column(name = "isCombined", columnDefinition = "tinyint(1)")
private boolean isCombined;
@Column(name = "skipMerge", columnDefinition = "tinyint(1)")
private boolean skipMerge;
}
My repository class:
package com.chansoft.Repositories;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import com.chansoft.Entities.FilesEntity;
@RepositoryRestResource(exported = false)
public interface FilesRepository extends CrudRepository<FilesEntity, Long> {
public List<FilesEntity> findByFileDirectoryIgnoreCase(String FileDirectory);
public List<FilesEntity> findByUploaded(boolean Uploaded);
public List<FilesEntity> findByIsCombinedAndSkipMerge(boolean IsCombined, boolean SkipMerge);
}
Anyone have any clues? Its not missing a dependency since it was working earlier before, without the altered table. I tried commenting out the skipMerge part in the entity, repository, services and controllers to no avail.
Thanks!
Edit: I am getting this as my stacktrace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: Receiver class org.hibernate.validator.engine.ConfigurationImpl does not define or inherit an implementation of the resolved method 'abstract javax.validation.ParameterNameProvider getDefaultParameterNameProvider()' of interface javax.validation.Configuration.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.18.jar:5.3.18]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.18.jar:5.3.18]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar:5.3.18]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar:5.3.18]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar:5.3.18]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar:5.3.18]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar:5.3.18]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.18.jar:5.3.18]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.18.jar:5.3.18]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.18.jar:5.3.18]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.6.jar:2.6.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) ~[spring-boot-2.6.6.jar:2.6.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) ~[spring-boot-2.6.6.jar:2.6.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-2.6.6.jar:2.6.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[spring-boot-2.6.6.jar:2.6.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.6.jar:2.6.6]
at com.chansoft.PdfOcrReaderApplication.main(PdfOcrReaderApplication.java:10) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.6.6.jar:2.6.6]
Caused by: java.lang.AbstractMethodError: Receiver class org.hibernate.validator.engine.ConfigurationImpl does not define or inherit an implementation of the resolved method 'abstract javax.validation.ParameterNameProvider getDefaultParameterNameProvider()' of interface javax.validation.Configuration.
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.conf
igureParameterNameProvider(LocalValidatorFactoryBean.java:327) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:293) ~[spring-context-5.3.18.jar:5.3.18] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.18.jar:5.3.18] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.18.jar:5.3.18] ... 21 common frames omitted
CodePudding user response:
The failure is unrelated to the change you made to your entity.
The exception indicates that the version of Hibernate Validator on your classpath is not compatible with the version of the Validation API that is on the classpath. Hibernate Validator is older than the API and does not implement getDefaultParameterNameProvider
.
You can correct the problem by changing your build.gradle or pom.xml. With Spring Boot 2.6.6 you should be using Hibernate Validator 6.2.3.Final. If you are using Spring Boot’s dependency management, you can remove the version in your build script and it will then use 6.2.3.Final automatically.