• Mingyang.net:java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()


    使用hibernate-validator校验数据模型时报出如下异常:

    java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory;
        at org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm.<clinit>(InterpolationTerm.java:59)
        at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateExpression(ResourceBundleMessageInterpolator.java:341)
        at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateMessage(ResourceBundleMessageInterpolator.java:279)
        at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolate(ResourceBundleMessageInterpolator.java:194)
        at org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator.interpolate(LocaleContextMessageInterpolator.java:50)
        at org.hibernate.validator.internal.engine.ValidationContext.interpolate(ValidationContext.java:362)
        at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolation(ValidationContext.java:271)
        at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolations(ValidationContext.java:232)
        at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:291)
        at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:133)
        at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateComposingConstraints(ConstraintTree.java:233)
        at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:102)
        at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:91)
        at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:83)
        at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:547)
        at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:487)
        at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:451)
        at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:403)
        at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:206)
        at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:108)
        at org.springframework.validation.DataBinder.validate(DataBinder.java:760)
        ......

    原因是如果想在消息中使用EL表达式,请确保EL表达式版本是 2.2或以上。我用的是Tomcat6,lib目录下的el-api.jar是2.1版本的,可以到Tomcat7拷贝一个。

  • 相关阅读:
    在spring boot中三分钟上手apache顶级分布式链路追踪系统skywalking
    Spring Boot Admin 2.1.0
    Spring Boot Admin 详解(Spring Boot 2.0,基于 Eureka 的实现)
    Spring Cloud Sleuth + Zipkin 链路监控
    guava布隆过滤器
    红包算法
    java国际化之时区问题处理
    SpringCloud2.0 Hystrix Feign 基于Feign实现断路器
    SpringBoot 自定义线程池,多线程
    基于Redisson+SpringBoot的Redission分布式锁
  • 原文地址:https://www.cnblogs.com/eastson/p/3884864.html
Copyright © 2020-2023  润新知