Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver while running spring boot app

I am trying to run one sample application integrated with keycloak (for IAM). Build is success but while running the application, I get below error ...

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-07-19 11:30:28.660 ERROR 103440 --- [           main] o.s.boot.SpringApplication               : Application run failed

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.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1708) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.keycloak.quickstarts.devconf2019.app.CarsApp.main(CarsApp.java:38) [classes/:na]
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver


I have added com.fasterxml.jackson.core(2.9.5) and com.fasterxml(1.3.1) as dependency. Springboot version is - 2.0.3.RELEASE

Is there any version compatibility issue with fasterxml dependency ? How to find the missing dependency and resolve this ?

like image 627
AmitK Avatar asked Oct 16 '25 14:10

AmitK


1 Answers

You need to add the hibernate-validator dependency, it comes with the com.fasterxml:classmate bundled into it.

<dependency>
    <groupId>org.hibernate.validator</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>7.0.1.Final</version>
</dependency>
like image 128
Charles Avatar answered Oct 18 '25 07:10

Charles