-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Encountered problem validating using Hibernate validator
PostPosted: Tue Aug 03, 2010 3:07 am 
Newbie

Joined: Tue Aug 03, 2010 2:24 am
Posts: 2
Hello, This is my third day on this issue, I tried to use the annotations support in the hibernate validator for my project but after following tutorials, on running my application I kept on getting an exception: java.lang.NoSuchMethodError. Below is my stacktrace

exception

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Persistence.getPersistenceUtil()Ljavax/persistence/PersistenceUtil;
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

Root Cause

java.lang.NoSuchMethodError: javax.persistence.Persistence.getPersistenceUtil()Ljavax/persistence/PersistenceUtil;
org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:33)
org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:112)
org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:761)
org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:331)
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:278)
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:260)
org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:213)
org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:74)
org.springframework.validation.DataBinder.validate(DataBinder.java:692)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doBind(HandlerMethodInvoker.java:797)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:349)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:169)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

I am using spring 3 and hibernate 3.2.5 with jdk 1.6.0_14 and hibernate-validator-4.1.0.Final and netbeans 6.9

Listed below are libraries in my classpath


antlr-2.7.6.jar
asm-attrs.jar
asm.jar
cglib-2.1.3.jar
cglib-2.2.jar
commons-collections-2.1.1.jar
commons-logging-1.1.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate-tools.jar
hibernate-validator-4.1.0.Final.jar
hibernate3.jar
javaee-api-6.0.jar
javassist.jar
jdbc2_0-stdext.jar
jstl.jar
jta.jar
log4j-1.2.14.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
spring-aop-3.0.2.RELEASE.jar
spring-asm-3.0.2.RELEASE.jar
spring-aspects-3.0.2.RELEASE.jar
spring-beans-3.0.2.RELEASE.jar
spring-context-3.0.2.RELEASE.jar
spring-context-support-3.0.2.RELEASE.jar
spring-core-3.0.2.RELEASE.jar
spring-expression-3.0.2.RELEASE.jar
spring-instrument-3.0.2.RELEASE.jar
spring-instrument-tomcat-3.0.2.RELEASE.jar
spring-jdbc-3.0.2.RELEASE.jar
spring-jms-3.0.2.RELEASE.jar
spring-orm-3.0.2.RELEASE.jar
spring-oxm-3.0.2.RELEASE.jar
spring-struts-3.0.2.RELEASE.jar
spring-test-3.0.2.RELEASE.jar
spring-tx-3.0.2.RELEASE.jar
spring-web-3.0.2.RELEASE.jar
spring-webmvc-3.0.2.RELEASE.jar
spring-webmvc-portlet-3.0.2.RELEASE.jar
standard.jar
validation-api-1.0.0.GA.jar

Please I will appreciate if I can get a solution to my problem


Top
 Profile  
 
 Post subject: Re: Encountered problem validating using Hibernate validator
PostPosted: Tue Aug 03, 2010 6:11 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
hibernate 3.2.5 is not compatible with jpa-2, upgrade to hibernate 3.5.x (latest is 3.5.4 at this time)

you're mixing dependencies from several uncompatible versions.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Encountered problem validating using Hibernate validator
PostPosted: Thu Aug 05, 2010 3:21 am 
Newbie

Joined: Tue Aug 03, 2010 2:24 am
Posts: 2
Thank you very much for response, however the problem still persist after I upgraded hibernate to version 3.5.4

This how my controller looks

@Controller
@RequestMapping("/form.htm")
public class FormTestController {

@RequestMapping(method = RequestMethod.GET)
public String get(final ModelMap model) {

UserForm userForm = new UserForm();
model.addAttribute("userForm", userForm);
return "form";
}

@RequestMapping(method = RequestMethod.POST)
public String post(final ModelMap model, @Valid final UserForm userForm,
final BindingResult result) {

if (result.hasErrors()) {
return "form";
}

return "success";
}
}

My entity class looks like this

public class UserForm {

@NotEmpty
@Size(max = 20)
private String name;
@NotEmpty
@Email
private String email;

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}


and libraries in my classpath after I upgraded to hibernate 3.5.4 looks like this

antlr-2.7.6.jar
asm-attrs.jar
asm.jar
cglib-2.1.3.jar
cglib-2.2.jar
commons-collections-2.1.1.jar
commons-collections-3.1.jar
commons-logging-1.1.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate-testing.jar
hibernate-tools.jar
hibernate-validator-4.1.0.Final.jar
hibernate3.jar
javaee-api-6.0.jar
javassist-3.9.0.GA.jar
javassist.jar
jdbc2_0-stdext.jar
jstl.jar
jta-1.1.jar
jta.jar
log4j-1.2.14.jar
slf4j-api-1.5.6.jar
slf4j-api-1.5.8.jar
slf4j-log4j12-1.5.6.jar
spring-aop-3.0.2.RELEASE.jar
spring-asm-3.0.2.RELEASE.jar
spring-aspects-3.0.2.RELEASE.jar
spring-beans-3.0.2.RELEASE.jar
spring-context-3.0.2.RELEASE.jar
spring-context-support-3.0.2.RELEASE.jar
spring-core-3.0.2.RELEASE.jar
spring-expression-3.0.2.RELEASE.jar
spring-instrument-3.0.2.RELEASE.jar
spring-instrument-tomcat-3.0.2.RELEASE.ja
r
spring-jdbc-3.0.2.RELEASE.jar
spring-jms-3.0.2.RELEASE.jar
spring-orm-3.0.2.RELEASE.jar
spring-oxm-3.0.2.RELEASE.jar
spring-struts-3.0.2.RELEASE.jar
spring-test-3.0.2.RELEASE.jar
spring-tx-3.0.2.RELEASE.jar
spring-web-3.0.2.RELEASE.jar
spring-webmvc-3.0.2.RELEASE.jar
spring-webmvc-portlet-3.0.2.RELEASE.jar
standard.jar
validation-api-1.0.0.GA.jar

I hope I can get the validator to work for my project


Top
 Profile  
 
 Post subject: Re: Encountered problem validating using Hibernate validator
PostPosted: Wed Sep 01, 2010 1:08 pm 
Newbie

Joined: Wed Sep 01, 2010 7:29 am
Posts: 3
Hi,

We faced the similar error, it turned out JDK 1.5 does not have the enhanced persistance method which HA is looking for.
Please check once again your environment(devel/deploy) is pointing to JDK 1.6.

~rohit.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.