title: How do I fix the hibernate validator problem with spring boot and ejb intergration
body: <p>I am using some of the jars that have ejb services for a spring based rest interface I am trying to build. I am using spring boot for the project. I added the required dependencies, but the application is having issues with hibernate validator. Can someone please look at it and let me know what could be wrong with it? Please find the stack trace below:</p>
  
  <pre><code> org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.validation.beanvalidation.LocalValidatorFactoryBean]: Factory method 'defaultValidator' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      at com.mrs.MrsApplication.main(MrsApplication.java:25) [classes/:na]
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.validation.beanvalidation.LocalValidatorFactoryBean]: Factory method 'defaultValidator' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      ... 19 common frames omitted
  Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
      at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:33) ~[hibernate-validator-6.0.17.Final.jar:6.0.17.Final]
      at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:296) ~[validation-api-2.0.1.Final.jar:na]
      at org.springframework.boot.validation.MessageInterpolatorFactory.getObject(MessageInterpolatorFactory.java:53) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      at org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration.defaultValidator(ValidationAutoConfiguration.java:57) ~[spring-boot-autoconfigure-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_151]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_151]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_151]
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      ... 20 common frames omitted
  
  </code></pre>
  
  <p>Please find the dependencies from the pom.xml below:</p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
                      &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web-services&lt;/artifactId&gt;
               &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
                      &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;
              &lt;artifactId&gt;jboss-logging&lt;/artifactId&gt;
              &lt;version&gt;3.3.3.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Please find the mvn dependency tree below:</p>
  
  <pre><code>[INFO]
  [INFO] --- maven-dependency-plugin:3.1.1:tree (default-cli) @ mrs ---
  [INFO] com.mrs:mrs:jar:0.0.1-SNAPSHOT
  [INFO] +- log4j:log4j:jar:1.2.17:compile
  [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.8.RELEASE:compile
  [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.1.8.RELEASE:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.1.8.RELEASE:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.8.RELEASE:compile
  [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.8.RELEASE:compile
  [INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
  [INFO] |  |  |  |  +- ch.qos.logback:logback-core:jar:1.2.3:compile
  [INFO] |  |  |  |  \- org.slf4j:slf4j-api:jar:1.7.28:compile
  [INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.2:compile
  [INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.11.2:compile
  [INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.28:compile
  [INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
  [INFO] |  |  +- org.springframework:spring-core:jar:5.1.9.RELEASE:compile
  [INFO] |  |  |  \- org.springframework:spring-jcl:jar:5.1.9.RELEASE:compile
  [INFO] |  |  \- org.yaml:snakeyaml:jar:1.23:runtime
  [INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.1.8.RELEASE:compile
  [INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.9.3:compile
  [INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
  [INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile
  [INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.9:compile
  [INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.9:compile
  [INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.9:compile
  [INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.8.RELEASE:compile
  [INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.24:compile
  [INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.24:compile
  [INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.24:compile
  [INFO] |  +- org.hibernate.validator:hibernate-validator:jar:6.0.17.Final:compile
  [INFO] |  |  \- com.fasterxml:classmate:jar:1.4.0:compile
  [INFO] |  +- org.springframework:spring-web:jar:5.1.9.RELEASE:compile
  [INFO] |  |  \- org.springframework:spring-beans:jar:5.1.9.RELEASE:compile
  [INFO] |  \- org.springframework:spring-webmvc:jar:5.1.9.RELEASE:compile
  [INFO] |     +- org.springframework:spring-aop:jar:5.1.9.RELEASE:compile
  [INFO] |     +- org.springframework:spring-context:jar:5.1.9.RELEASE:compile
  [INFO] |     \- org.springframework:spring-expression:jar:5.1.9.RELEASE:compile
  [INFO] +- org.springframework.boot:spring-boot-starter-web-services:jar:2.1.8.RELEASE:compile
  [INFO] |  +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.5.0:compile
  [INFO] |  |  +- javax.xml.soap:javax.xml.soap-api:jar:1.4.0:compile
  [INFO] |  |  +- org.jvnet.mimepull:mimepull:jar:1.9.11:compile
  [INFO] |  |  \- org.jvnet.staxex:stax-ex:jar:1.8:compile
  [INFO] |  +- javax.xml.ws:jaxws-api:jar:2.3.1:compile
  [INFO] |  |  \- javax.xml.bind:jaxb-api:jar:2.3.1:compile
  [INFO] |  |     \- javax.activation:javax.activation-api:jar:1.2.0:compile
  [INFO] |  +- org.springframework:spring-oxm:jar:5.1.9.RELEASE:compile
  [INFO] |  \- org.springframework.ws:spring-ws-core:jar:3.0.7.RELEASE:compile
  [INFO] |     +- org.springframework.ws:spring-xml:jar:3.0.7.RELEASE:compile
  [INFO] |     \- commons-io:commons-io:jar:2.5:compile
  [INFO] +- com.google.code.gson:gson:jar:2.8.5:compile
  [INFO] +- org.jboss.logging:jboss-logging:jar:3.3.3.Final:compile
  [INFO] \- javax.validation:validation-api:jar:2.0.1.Final:compile
  
  </code></pre>