Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.ClassNotFoundException: org.hibernate.validator.method.MethodValidator #141

Closed
jorgheymans opened this issue Jul 18, 2017 · 2 comments

Comments

@jorgheymans
Copy link

jorgheymans commented Jul 18, 2017

Hi,

I have a deployment issue after upgrading my app to spring-cloud Dalston.SR1:

Caused By: java.lang.ClassNotFoundException: org.hibernate.validator.method.MethodValidator
	at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:364)
	at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:325)
	at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:80)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:193)
	at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:50)
	at org.springframework.validation.beanvalidation.MethodValidationInterceptor$HibernateValidatorDelegate.invokeWithinValidation(MethodValidationInterceptor.java:185)
	at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:152)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
	at org.springframework.cloud.zookeeper.ZookeeperProperties$$EnhancerBySpringCGLIB$$195c3f00.getBaseSleepTimeMs(<generated>)
	at org.springframework.cloud.zookeeper.ZookeeperAutoConfiguration.exponentialBackoffRetry(ZookeeperAutoConfiguration.java:79)
	at org.springframework.cloud.zookeeper.ZookeeperAutoConfiguration$$EnhancerBySpringCGLIB$$413b2ff7.CGLIB$exponentialBackoffRetry$1(<generated>)
	at org.springframework.cloud.zookeeper.ZookeeperAutoConfiguration$$EnhancerBySpringCGLIB$$413b2ff7$$FastClassBySpringCGLIB$$88b0432d.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
	at org.springframework.cloud.zookeeper.ZookeeperAutoConfiguration$$EnhancerBySpringCGLIB$$413b2ff7.exponentialBackoffRetry(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)

I am using spring boot 1.5.4 which brings in hibernate-validator 5.3 and this one no longer has this class. When i downgrade hibernate-validator to latest 4.x i am getting a different error

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'encryptionBootstrapConfiguration': Unsatisfied dependency expressed through field 'key'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'encrypt-org.springframework.cloud.bootstrap.encrypt.KeyProperties': Initialization of bean failed; nested exception is java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues

Not sure how to get out of this, seems that spring 4 requires validator 4.x but spring-cloud needs 5.x , is this correct ?

Apologies if this is not the correct spring-cloud subproject, but since cloud.zookeeper is first in the stacktrace i am posting it here.

@spencergibb
Copy link
Member

I think spring boot 1.5.x requires validator 5.x. Not sure there is much I can do.

@jorgheymans
Copy link
Author

jorgheymans commented Jul 18, 2017

Thanks for confirming, after a few attempts i managed to get the right combination of classpath tweaking by forcing weblogic to use both javax.validation and org.hibernate.validator from the application rather than the server (prefer-application-packages for the weblogic initiated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants