zoukankan      html  css  js  c++  java
  • 【日常错误】Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl

    最近在用spring-boot编写一个Lucene项目,中间用到了redis,引用了spring-boot-starter-data-redis,在eclipse中用外部Tomcat启动项目一切正常,但是在运行Junit测试用例或使用spring-boot的application的main方法启动项目时,会报如下错误:

    1 2017-11-01 16:45:20.166  WARN 14252 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'buildController': Unsatisfied dependency expressed through field 'redisTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConfig': Unsatisfied dependency expressed through field 'redisConnectionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration$RedisConnectionConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
    2 2017-11-01 16:45:20.206  INFO 14252 --- [           main] utoConfigurationReportLoggingInitializer : 
    3 
    4 Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
    5 2017-11-01 16:45:20.230 ERROR 14252 --- [           main] o.s.boot.SpringApplication               : Application startup failed

    搜索堆栈中错误信息,很多博客都说是  hibernate-validator  版本冲突的问题:

    http://www.jianshu.com/p/a33518f4012f

    https://howtodoinjava.com/spring/spring-mvc/solved-java-lang-noclassdeffounderror-could-not-initialize-class-org-hibernate-validator-engine-configurationimpl/

    于是尝试在pom文件中exclude排除spring-boot中自带的这个jar包:

    在pom.xml代码里的配置变为如下:

    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-validator</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

    解决。

  • 出处: http://www.cnblogs.com/hiscode/
    本文版权归作者和博客园共有,转载请在文章页面明显位置标明原文链接。
查看全文
  • 相关阅读:
    [转]rdlc报表中表达式的使用--switch和IIF范例
    [转]关于ASP.NET(C#)程序中TEXTBOX下动态DIV跟随[AJAX应用]
    CodeForces
    NYOJ306 走迷宫(dfs+二分搜索)
    全心全意为人民服务体如今我们软件设计上
    2014年麦克阿瑟基金奖,张益唐入围(62万美金用于个人支配)
    Android中SharedPreferences函数具体解释
    drupal7中CKEditor开启上传图片功能
    JBoss+Ant实现EJB无状态会话bean实例
    c#读取xml文件配置文件Winform及WebForm-Demo具体解释
  • 原文地址:https://www.cnblogs.com/hiscode/p/Could_not_initialize_class_ConfigurationImpl.html
  • Copyright © 2011-2022 走看看