-->
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.  [ 10 posts ] 
Author Message
 Post subject: BeanValidation Configure
PostPosted: Mon Sep 28, 2009 1:58 pm 
Newbie

Joined: Mon Sep 28, 2009 1:40 pm
Posts: 2
I am developing a project with Hibernate using maven, some of the units are:

.....
.....
hibernate-annotations, version 3.5.0.Beta-1
hibernate-EntityManager, version 3.5.0.Beta-1
hibernate-validator version 4.0.0.CR1
....
....


My persistence.xml is:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="HipokratesPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <non-jta-data-source>HipokratesDS</non-jta-data-source>
    <class>com.logikas.hipokrates.gwt.domain.entity.Person</class>
  </persistence-unit>
</persistence>


The File validation.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<validation-config
         xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd">
     <default-provider/>
     <message-interpolator/>
</validation-config>


In Hibernate (3.5.0.Beta-1), i need configuring JPA2.0?
How?

With the current configuration this is the error that I have:

Code:
javax.persistence.PersistenceException: [PersistenceUnit: HipokratesPU] Unable to configure EntityManagerFactory
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:303)
        at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:163)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:76)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
        at com.wideplay.warp.persist.jpa.EntityManagerFactoryProvider$1.get(EntityManagerFactoryProvider.java:56)
        at com.wideplay.warp.persist.jpa.EntityManagerFactoryProvider$1.get(EntityManagerFactoryProvider.java:49)
        at com.wideplay.warp.persist.internal.LazyReference.get(LazyReference.java:53)
        at com.wideplay.warp.persist.jpa.EntityManagerFactoryProvider.get(EntityManagerFactoryProvider.java:71)
        at com.wideplay.warp.persist.jpa.EntityManagerFactoryProvider.get(EntityManagerFactoryProvider.java:36)
        at com.wideplay.warp.persist.jpa.JpaPersistenceService.start(JpaPersistenceService.java:45)
        at com.wideplay.warp.persist.PersistenceFilter$2$1.start(PersistenceFilter.java:103)
        at com.wideplay.warp.persist.internal.Lifecycles.failEarly(Lifecycles.java:39)
        at com.wideplay.warp.persist.PersistenceFilter.init(PersistenceFilter.java:118)
        at com.google.inject.servlet.FilterDefinition.init(FilterDefinition.java:81)
        at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:102)
        at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:168)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:145)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:753)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:661)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:914)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:166)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.FixedThreadPool$BasicWorker.dowork(FixedThreadPool.java:379)
        at com.sun.grizzly.util.FixedThreadPool$BasicWorker.run(FixedThreadPool.java:360)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.hibernate.HibernateException: Unable to get the default Bean Validation factory
        at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:105)
        at org.hibernate.cfg.AnnotationConfiguration.applyDDLOnBeanValidation(AnnotationConfiguration.java:403)
        at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:399)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1162)
        at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1291)
        at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:195)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:919)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:211)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:291)
        ... 41 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:96)
        ... 49 more
Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory
        at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:302)
        at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:82)
        ... 54 more
Caused by: javax.validation.ValidationException: Unable to instantiate validation provider class .
        at org.hibernate.validation.xml.ValidationXmlParser.setProviderClassFromXml(ValidationXmlParser.java:211)
        at org.hibernate.validation.xml.ValidationXmlParser.parseValidationXml(ValidationXmlParser.java:69)
        at org.hibernate.validation.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:187)
        at org.hibernate.validation.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:116)
        at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
        at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:299)
        ... 55 more


I think the error is due to the configuration, but, i not know how to configuring Bean Validation.

Any ideas?

Thank you.


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Tue Oct 06, 2009 10:48 pm 
Newbie

Joined: Tue Oct 06, 2009 10:44 pm
Posts: 2
Hi,
I have the exact same issue. Does anyone have a solution yet?
I noticed that the method its trying to invoke is actually in an interface and I do not understand how to tell Hibernate to use that implementation if it exists in one the jars.

Regards,
Anand.


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Fri Sep 17, 2010 9:06 am 
Newbie

Joined: Fri Sep 17, 2010 8:23 am
Posts: 5
Looks like the hibernate validator is not in your classpath (which contains the actual implementation of the described method by the interface).
I ran into the exact same error. Getting the hibernate validator from http://sourceforge.net/projects/hibernate/files/hibernate3/ and including it in my classpath solved the error.


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Sat Oct 09, 2010 1:54 am 
Newbie

Joined: Sat Oct 09, 2010 1:28 am
Posts: 1
I'm running into this issue as well. I've tried placing the validation jars in my web libs directory, as suggested by the last poster, but this did not seem to help. I am using Hibernate 3.6.0 CR2, Hibernate Validator 4.1.0 (Final), Spring 3.0.4, Struts2 2.2.1, and Glassfish v3. Any help would be appreciated.


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Wed Aug 17, 2011 2:14 pm 
Newbie

Joined: Wed Aug 17, 2011 2:10 pm
Posts: 1
I have solved an equal error trace by deleting this lines from my POM.XML

Quote:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>



I think I had a conflict with Validation libraries or something similar.

I hope to be util for you.

Regards,
Miguel


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Thu Sep 22, 2011 4:42 pm 
Newbie

Joined: Thu Sep 22, 2011 4:27 pm
Posts: 2
I was facing same issue in JBoss 6 and i am able to solve it by removing validation-api-1.0.0.GA.jar from my applcation war file. hibernate-validator-4.1.0.Final.jar is still part of application war. For Jboss 5 both jar files are required


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Thu Dec 08, 2011 3:17 am 
Newbie

Joined: Thu Dec 08, 2011 3:09 am
Posts: 1
ashafqat wrote:
I was facing same issue in JBoss 6 and i am able to solve it by removing validation-api-1.0.0.GA.jar from my applcation war file. hibernate-validator-4.1.0.Final.jar is still part of application war. For Jboss 5 both jar files are required

Yeah, bro. It helped. I just removed my GWT library from build path ant all became fine. This library contain validation-api-1.0.0.GA.jar which caused error.


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Wed Dec 21, 2011 2:47 am 
Newbie

Joined: Wed Dec 21, 2011 2:39 am
Posts: 1
This is just to confirm that the conflict is in the validation-api-1.0.0.GA.jar

I'm using GWT 2.4 (as a plugin to STS-2.8.1) and Hibernate 3.5.2, along with SpringFramework 3.0.5 and got the same problem. After removing the validator-api-1.0.0.GA.jar from the <Eclipse Home>/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201112160242-rel-r37/gwt-2.4.0 directory it worked.

Thanks for the tip


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Fri Jan 20, 2012 10:38 am 
Newbie

Joined: Fri Jan 20, 2012 10:34 am
Posts: 1
If you add hibernate-validator jars to your hibernate lib (including validation-api-1.0.0.GA.jar) it will be ok
hope it helps :)


Top
 Profile  
 
 Post subject: Re: BeanValidation Configure
PostPosted: Wed May 23, 2012 6:02 pm 
Newbie

Joined: Tue Oct 14, 2008 3:08 pm
Posts: 8
Location: Brasil
I had this problem with the following dependencies:

Code:
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-c3p0</artifactId>
         <version>3.6.10.Final</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-validator</artifactId>
         <version>4.2.0.Final</version>
      </dependency>


I changed to:

Code:
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-c3p0</artifactId>
         <version>3.6.10.Final</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-validator</artifactId>
         <version>4.1.0.Final</version>
      </dependency>


And it worked fine!

_________________
Bruno Medeiros


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.