java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.m

javax.validation.Validator.validator.validate(object, groups) bean验证注解报错,异常:

java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm
	at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateExpression(ResourceBundleMessageInterpolator.java:227)
	at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateMessage(ResourceBundleMessageInterpolator.java:187)
	at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolate(ResourceBundleMessageInterpolator.java:115)
	at org.hibernate.validator.internal.engine.ValidationContext.interpolate(ValidationContext.java:370)
	at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolation(ValidationContext.java:284)
	at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolations(ValidationContext.java:246)
	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:289)
	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:133)
	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:91)
	at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:85)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:478)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:424)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:388)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:340)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:158)
	at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:136)
	at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreUpdate(BeanValidationEventListener.java:102)
	at org.hibernate.action.internal.EntityUpdateAction.preUpdate(EntityUpdateAction.java:228)
	at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:115)
	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276)

源码位置:

	private String interpolateExpression(String message, Pattern pattern, Context context, Locale locale) {
		Matcher matcher = pattern.matcher( message );
		StringBuffer sb = new StringBuffer();

		while ( matcher.find() ) {
			String match = matcher.group( 1 );
			InterpolationTerm expression = new InterpolationTerm( match, locale );
			if ( expression.needsEvaluation() ) {
				String resolvedExpression = expression.interpolate( context );
				resolvedExpression = Matcher.quoteReplacement( resolvedExpression );
				matcher.appendReplacement( sb, resolvedExpression );
			}
		}
		matcher.appendTail( sb );
		return sb.toString();
	}

原因:name值为空,有@Length时,需要@NotNull属性,否则会抛出异常

	//@NotNull(message = "样品名称为空或不存在")
	@Length(min=1, max=200)
	@ExcelField(title="样品名称", align=2, sort=10)
	public String getName() {
		return name;
	}

时间: 2024-10-09 04:51:36

java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.m的相关文章

[错误日志]Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl

最近在练习SpringBoot框架的时候,遇到这个很奇怪的问题.我是通过sts的Spring start project功能直接生成的工程,当选择SpringBoot2.2版本以下的时候,运行没有任何问题,一旦选择2.2以上的版本时,会报 Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl 这个错误. 经过检查发现SpringBoot已经自动依赖了该包: 分析有可能是jar包版本

异常:Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.log4jdbc.Properties

参考文章: 使用Log4jdbc-log4j2监听MyBatis中运行的SQL和Connection 使用 log4jdbc格式化输出SQL,maven配置如下: <dependency> <groupId>org.bgee.log4jdbc-log4j2</groupId> <artifactId>log4jdbc-log4j2-jdbc4</artifactId> <version>1.16</version> <

java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart

最近在进行利用jfreechart生成图表时发现,项目在本地运行的好好的,一部署到服务器(linux系统)上就不行,报这样的错误: java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart,后来经过搜索解决了,详见如下: 1.首先,这与服务器上操作系统是linux系统有关,因为linux系统本身是无图形化界面的,所以在JFreeChart chart = ChartFactory.c

日志异常:java.lang.NoClassDefFoundError: Could not initialize class org.slf4j.impl.StaticLoggerBinder

今天启动开发的项目,碰到了一个日志上的bug:java.lang.NoClassDefFoundError: Could not initialize class org.slf4j.impl.StaticLoggerBinder.刚看到一脸懵.于是到网上查了一下,也有遇到类似问题的.说是要加一些依赖,但是我试了不起作用.后来看到了一篇讲slf4j集成logback和log4j的文章,给我了我灵感,尝试了一下,解决了问题.文章的地址:https://www.jianshu.com/p/9a283

java.lang.NoClassDefFoundError: Could not initialize class xxx 原因

一.问题及原因 程序里有个工具类,主要是调用它的静态方法来发送mq. 调用场景如下: 结果这两天报了个错: java.lang.NoClassDefFoundError: Could not initialize class com.ceiec.rabbitmqservice.utils.MQMessageSender 后来大概看了下,这个类的class文件是存在的.而且报的错也不是class找不到之类的. 翻了下svn记录,发现新增了一个static变量,这个变量的初始化会失败.(因为spri

java.lang.NoClassDefFoundError: Could not initialize class org.apache.jasper.el.ELContextImpl

启动项目报 用的tomcat版本是8 解决方案: 换成7 囧~

java.lang.NoClassDefFoundError: Could not initialize class ......

在测试数据字典工具类的时候一直报这个错误,找了好久,原来是SpringContextUtils这个类没有放入到容器中. 但是我在SpringContextUtils上面加了注解的,为什么注解没有扫到呢? 要不怎么说你蠢呢? spring配置文件中的base-package没有扫到这个工具类所在的包,我也是醉了...... <context:component-scan base-package="xxxx"/>

spring 项目tomcat 8.0.2 发布报错:Could not initialize class org.hibernate.validator.engine.ConfigurationImpl

tomcat 8 项目发布遇到的错 1 [ERROR] 2015-05-22 22:51:38,683 org.springframework.web.servlet.DispatcherServlet - Context initialization failed 2 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.valida

关于怎么解决java.lang.NoClassDefFoundError错误

五一在部署新的统一登录时,遇到这样一个问题: 很容易把java.lang.NoClassDefFoundError和java.lang.ClassNotfoundException这两个错误搞混,事实上这两个错误是完全不同的. NoClassDefFoundError错误发生的原因 NoClassDefFoundError错误的发生,是因为Java虚拟机在编译时能找到合适的类,而在运行时不能找到合适的类导致的错误.例如在运行时我们想调用某个类的方法或者访问这个类的静态成员的时候,发现这个类不可用