javax.validation.ValidationException: Unable to initialize org.hibernate.validator.constraints.impl.SizeValidatorForString

Hibernate JIRA | David J. M. Karlsen | 6 years ago
  1. 0

    See https://github.com/davidkarlsen/hibernate-validator/tree/HV-448 (never mind the naming of the branch - it was an old one - but changed to fit this issue). I get {noformat} javax.validation.ValidationException: Unable to initialize org.hibernate.validator.constraints.impl.SizeValidatorForString at org.hibernate.validator.engine.ConstraintTree.initializeConstraint(ConstraintTree.java:444) at org.hibernate.validator.engine.ConstraintTree.createAndInitializeValidator(ConstraintTree.java:346) at org.hibernate.validator.engine.ConstraintTree.getInitializedValidator(ConstraintTree.java:317) at org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:144) at org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:117) at org.hibernate.validator.metadata.MetaConstraint.validateConstraint(MetaConstraint.java:84) at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:473) at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:395) at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:376) at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:315) at org.hibernate.validator.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:634) at org.hibernate.validator.engine.ValidatorImpl.validateCascadedMethodConstraints(ValidatorImpl.java:532) at org.hibernate.validator.engine.ValidatorImpl.validateReturnValueForGroup(ValidatorImpl.java:1156) at org.hibernate.validator.engine.ValidatorImpl.validateReturnValueInContext(ValidatorImpl.java:1074) at org.hibernate.validator.engine.ValidatorImpl.validateReturnValue(ValidatorImpl.java:247) at org.hibernate.hv448.ValidationAspect.validateReturnedValue(ValidationAspect.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:603) at org.springframework.aop.aspectj.AspectJAfterReturningAdvice.afterReturning(AspectJAfterReturningAdvice.java:58) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy16.proceedOkWithDefinedArg(Unknown Source) at org.hibernate.hv448.ValidationAspectTest.proceedOkWithDefinedArg(ValidationAspectTest.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.ClassCastException: $Proxy22 cannot be cast to javax.validation.constraints.Size at org.hibernate.validator.constraints.impl.SizeValidatorForString.initialize(SizeValidatorForString.java:30) at org.hibernate.validator.engine.ConstraintTree.initializeConstraint(ConstraintTree.java:441) ... 59 more {noformat} when validating with a composed constraint.

    Hibernate JIRA | 6 years ago | David J. M. Karlsen
    javax.validation.ValidationException: Unable to initialize org.hibernate.validator.constraints.impl.SizeValidatorForString
  2. 0

    See https://github.com/davidkarlsen/hibernate-validator/tree/HV-448 (never mind the naming of the branch - it was an old one - but changed to fit this issue). I get {noformat} javax.validation.ValidationException: Unable to initialize org.hibernate.validator.constraints.impl.SizeValidatorForString at org.hibernate.validator.engine.ConstraintTree.initializeConstraint(ConstraintTree.java:444) at org.hibernate.validator.engine.ConstraintTree.createAndInitializeValidator(ConstraintTree.java:346) at org.hibernate.validator.engine.ConstraintTree.getInitializedValidator(ConstraintTree.java:317) at org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:144) at org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:117) at org.hibernate.validator.metadata.MetaConstraint.validateConstraint(MetaConstraint.java:84) at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:473) at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:395) at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:376) at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:315) at org.hibernate.validator.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:634) at org.hibernate.validator.engine.ValidatorImpl.validateCascadedMethodConstraints(ValidatorImpl.java:532) at org.hibernate.validator.engine.ValidatorImpl.validateReturnValueForGroup(ValidatorImpl.java:1156) at org.hibernate.validator.engine.ValidatorImpl.validateReturnValueInContext(ValidatorImpl.java:1074) at org.hibernate.validator.engine.ValidatorImpl.validateReturnValue(ValidatorImpl.java:247) at org.hibernate.hv448.ValidationAspect.validateReturnedValue(ValidationAspect.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:603) at org.springframework.aop.aspectj.AspectJAfterReturningAdvice.afterReturning(AspectJAfterReturningAdvice.java:58) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy16.proceedOkWithDefinedArg(Unknown Source) at org.hibernate.hv448.ValidationAspectTest.proceedOkWithDefinedArg(ValidationAspectTest.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.ClassCastException: $Proxy22 cannot be cast to javax.validation.constraints.Size at org.hibernate.validator.constraints.impl.SizeValidatorForString.initialize(SizeValidatorForString.java:30) at org.hibernate.validator.engine.ConstraintTree.initializeConstraint(ConstraintTree.java:441) ... 59 more {noformat} when validating with a composed constraint.

    Hibernate JIRA | 6 years ago | David J. M. Karlsen
    javax.validation.ValidationException: Unable to initialize org.hibernate.validator.constraints.impl.SizeValidatorForString
  3. 0

    java.lang.ClassCastException: com.sun.proxy.$Proxy is thrown when casting an EJB

    Stack Overflow | 3 years ago | Sebi
    java.lang.ClassCastException: com.sun.proxy.$Proxy22 cannot be cast to books.pointejb.UserViewBean
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Help!Exception by bidirectional one-to-many

    gilead | 7 years ago | xiamingmei
    java.lang.RuntimeException: java.lang.ClassCastException: $Proxy22 cannot be cast to org.hibernate.impl.SessionImpl
  6. 0

    Memcached Java客户端2.6.1发布 - 编程语言 - ITeye资讯

    iteye.com | 1 year ago
    java.lang.ClassCastException: cannot be cast to

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      $Proxy22 cannot be cast to javax.validation.constraints.Size

      at org.hibernate.validator.constraints.impl.SizeValidatorForString.initialize()
    2. Embedded GlassFish Web
      SizeValidatorForString.initialize
      1. org.hibernate.validator.constraints.impl.SizeValidatorForString.initialize(SizeValidatorForString.java:30)
      1 frame
    3. Vaadin
      ConstraintTree.validateConstraints
      1. org.hibernate.validator.engine.ConstraintTree.initializeConstraint(ConstraintTree.java:441)
      2. org.hibernate.validator.engine.ConstraintTree.createAndInitializeValidator(ConstraintTree.java:346)
      3. org.hibernate.validator.engine.ConstraintTree.getInitializedValidator(ConstraintTree.java:317)
      4. org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:144)
      5. org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:117)
      5 frames
    4. Embedded GlassFish Web
      MetaConstraint.validateConstraint
      1. org.hibernate.validator.metadata.MetaConstraint.validateConstraint(MetaConstraint.java:84)
      1 frame
    5. Vaadin
      ValidatorImpl.validateReturnValue
      1. org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:473)
      2. org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:395)
      3. org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:376)
      4. org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:315)
      5. org.hibernate.validator.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:634)
      6. org.hibernate.validator.engine.ValidatorImpl.validateCascadedMethodConstraints(ValidatorImpl.java:532)
      7. org.hibernate.validator.engine.ValidatorImpl.validateReturnValueForGroup(ValidatorImpl.java:1156)
      8. org.hibernate.validator.engine.ValidatorImpl.validateReturnValueInContext(ValidatorImpl.java:1074)
      9. org.hibernate.validator.engine.ValidatorImpl.validateReturnValue(ValidatorImpl.java:247)
      9 frames
    6. org.hibernate.hv448
      ValidationAspect.validateReturnedValue
      1. org.hibernate.hv448.ValidationAspect.validateReturnedValue(ValidationAspect.java:129)
      1 frame
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    8. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
      2. org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:603)
      3. org.springframework.aop.aspectj.AspectJAfterReturningAdvice.afterReturning(AspectJAfterReturningAdvice.java:58)
      4. org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
      5. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
      6. org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
      7. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
      8. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
      9. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      10. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      10 frames
    9. Unknown
      $Proxy16.proceedOkWithDefinedArg
      1. $Proxy16.proceedOkWithDefinedArg(Unknown Source)
      1 frame
    10. org.hibernate.hv448
      ValidationAspectTest.proceedOkWithDefinedArg
      1. org.hibernate.hv448.ValidationAspectTest.proceedOkWithDefinedArg(ValidationAspectTest.java:46)
      1 frame
    11. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    12. JUnit
      InvokeMethod.evaluate
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      4 frames
    13. Spring TestContext
      SpringJUnit4ClassRunner.runChild
      1. org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
      2. org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
      3. org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
      4. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
      4 frames
    14. JUnit
      ParentRunner$2.evaluate
      1. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
      2. org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      3. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      4. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      5. org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      6. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      6 frames
    15. Spring TestContext
      RunAfterTestClassCallbacks.evaluate
      1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
      2 frames
    16. JUnit
      ParentRunner.run
      1. org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      1 frame
    17. Spring TestContext
      SpringJUnit4ClassRunner.run
      1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
      1 frame
    18. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
      1 frame
    19. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      5 frames