我编写了一个小的hibernate应用程序,并获得以下stacktrace:
org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:154)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:312)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
at com.beingjavaguys.hbn.HibernateUtil.buildSessionFactory(HibernateUtil.java:18)
at com.beingjavaguys.hbn.HibernateUtil.<clinit>(HibernateUtil.java:10)
at crud.UserDao.addUser(UserDao.java:12)
at com.beingjavaguys.hbn.App.main(App.java:53)
Caused by: java.lang.NoClassDefFoundError: javax/validation/ParameterNameProvider
...
我不明白这个错误的原因。
码:
Configuration configuration = new Configuration();
configuration.configure();
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
configuration.getProperties()).build();
return configuration.buildSessionFactory(serviceRegistry); // exception thrown here
我的pom.xml:
...
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>provided</scope>
</dependency>
...
...
我已经阅读了相关主题,但是我真的不知道如何解决它-我不想推出Hibernate 4.0版本。
如何解决?
问题内容: 我按照此链接中的指南安装JSTL,但是在尝试启动JSP页面时遇到以下错误: java.lang.NoClassDefFoundError:javax / servlet / jsp / tagext / TagLibraryValidator taglib声明为: 我在Tomcat Web应用程序下安装了JSTL 1.1,并试图在我的项目中执行相同的操作,但是没有用。我也尝试了JSTL
Validator::make( array('key' => 'Foo'), array('key' => 'required|in:Foo') ); Validator::extend('foo', function($attribute, $value, $params){}); Validator::extend('foo', 'FooValidator@validate'); Valid
jquery.validate.js 是一款执行表单输入信息验证的jQuery插件。要求 jQuery 1.2.6+, compatible with 1.3.x 特点: 安装简单 内置超过20种数据验证方法 直列错误提示信息 可扩展的数据验证方法 使用内置的元数据或插件选项来指定您的验证规则 优雅的交互设计
问题内容: 我在项目中将jdk更改为9版本,然后发生错误: 我尝试通过在pom.com上添加以下内容来解决此问题,但对我而言不起作用: 还有其他解决方法吗? 问题答案: 将包含所需类的工件添加到类路径。 似乎(未经测试)您需要的是javax.annotated API。有关详细信息,请参见https://mvnrepository.com/artifact/javax.annotation/jav
Registering a validator Full featured example Registering a validator When you create a validator, a good idea is to assign it as an alias that will refer to this particular validator function. Handso