【问题标题】:Which Jar does Ljavax/validation/constraints/Pattern$Flag belongs to?Javax/validation/constraints/Pattern$Flag 属于哪个Jar?
【发布时间】:2020-10-13 09:08:12
【问题描述】:

我的类路径中有以下罐子:

  • jre 1.8.0_251
  • hibernate-validation-6.1.5 最终版
  • guava-29.0-jre
  • commons-codec-1.14
import javax.validation.constraints.Pattern;
@Pattern

我收到以下异常

错误堆栈

java.lang.NoClassDefFoundError: [Ljavax/validation/constraints/Pattern$Flag;
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at org.springframework.core.annotation.AttributeMethods.compute(AttributeMethods.java:256)
    at java.util.concurrent.ConcurrentMap.computeIfAbsent(Unknown Source)
    at org.springframework.core.annotation.AttributeMethods.forAnnotationType(AttributeMethods.java:252)
    at org.springframework.core.annotation.AnnotationTypeMapping.<init>(AnnotationTypeMapping.java:96)
    at org.springframework.core.annotation.AnnotationTypeMappings.addIfPossible(AnnotationTypeMappings.java:116)
    at org.springframework.core.annotation.AnnotationTypeMappings.addAllMappings(AnnotationTypeMappings.java:75)
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:68)
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:46)
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.createMappings(AnnotationTypeMappings.java:253)
    at java.util.concurrent.ConcurrentMap.computeIfAbsent(Unknown Source)
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.get(AnnotationTypeMappings.java:249)
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:206)
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:188)
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:175)
    at org.springframework.core.annotation.TypeMappedAnnotation.of(TypeMappedAnnotation.java:636)
    at org.springframework.core.annotation.MergedAnnotation.of(MergedAnnotation.java:596)
    at org.springframework.core.type.classreading.MergedAnnotationReadingVisitor.visitEnd(MergedAnnotationReadingVisitor.java:96)
    at org.springframework.asm.ClassReader.readElementValues(ClassReader.java:2775)
    at org.springframework.asm.ClassReader.readMethod(ClassReader.java:1183)
    at org.springframework.asm.ClassReader.accept(ClassReader.java:688)
    at org.springframework.asm.ClassReader.accept(ClassReader.java:400)
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:123)
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidJun 23, 2020 3:38:57 PM org.apache.catalina.core.ApplicationContext

【问题讨论】:

    标签: java spring exception jar hibernate-validator


    【解决方案1】:

    尝试使用来自的jar,看起来它属于这个验证包: https://mvnrepository.com/artifact/javax.validation/validation-api/2.0.0.Final

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-30
      • 2016-11-24
      • 2015-12-26
      • 2012-03-28
      • 2017-01-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多