开发者

GWT doesn´t find my persistence.xml

开发者 https://www.devze.com 2023-03-30 23:08 出处:网络
I´m trying to save a simple user in my jpa hibernate db. So I have a persistence.xml that I know that works (If I execute a simple test without deploying the gwt app).

I´m trying to save a simple user in my jpa hibernate db. So I have a persistence.xml that I know that works (If I execute a simple test without deploying the gwt app).

The problem is that when I test it with my user interface, the persist method throw me the next error: (I think this is ca开发者_开发问答use Doesn´t find the persistence.xml)

[ERROR] javax.persistence.PersistenceException: [PersistenceUnit: isw2.tasks] Unable to >configure EntityManagerFactory

... bla bla bla

[ERROR] Caused by: org.hibernate.HibernateException: Unable to get the default Bean >Validation factory

... more bla bla bla..

[ERROR] Caused by: java.lang.reflect.InvocationTargetException

... [ERROR] Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory

[ERROR] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:383)

[ERROR] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:109)

.....

[ERROR] Caused by: javax.validation.ValidationException: Unable to find a default provider

[ERROR] at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)

[ERROR] at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)

[ERROR] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.ja

This is the method I know that works:

`EntityManagerFactory emf = Persistence .createEntityManagerFactory("isw2.tasks"); em = emf.createEntityManager();

    em.getTransaction().begin();

    em.persist(u);

    em.getTransaction().commit();
    em.clear();
    em.close();

`

And the most usefull for us, my proyect skeleton: (See that the persistence.xml file is there!)

GWT doesn´t find my persistence.xml

I´m using maven and deploying the web app with the codehaus plugin.

Thanks in advance experts ;)


The exception message Unable to find a default provider suggests that hibernate cannot find a validation provider.

Is your Hibernate Validator jar on your runtime classpath? Also do note that you need to use Hibernate Validator 4 or later.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号