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.