Persistence não encontrado

86 views
Skip to first unread message

Ricardo Leite

unread,
Apr 22, 2014, 12:00:03 PM4/22/14
to caelum-...@googlegroups.com
Pessoal,
  estou com Vraptor 4 com JPA, já tive esse erro e não estou conseguindo mais corrigir, creio que é ambiente, uso linux.  Parece que tudo esta certo mais dá o erro abaixo
javax.persistence.PersistenceException: No Persistence provider for EntityManager named default

alguem já teve esse problema?

att,
Ricardo

Marcio Angelo Matté

unread,
Apr 22, 2014, 12:09:10 PM4/22/14
to caelum-...@googlegroups.com
Ricardo, está usando Hibernate ou EclipseLink?

Se for o hibernate, tem que adicionar o provider no persistence. Segue um exemplo que uso em um projeto.

Meu Hibernate é o 4.3.4

<?xml version="1.0" encoding="UTF-8"?>
    <persistence-unit name="default" transaction-type="JTA">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <jta-data-source>jdbc/coopDS</jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.use_sql_comments" value="true"/>
            <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform" />
        </properties>
    </persistence-unit>
</persistence>


--
You received this message because you are subscribed to the Google Groups "caelum-vraptor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caelum-vrapto...@googlegroups.com.
To post to this group, send email to caelum-...@googlegroups.com.
Visit this group at http://groups.google.com/group/caelum-vraptor.
For more options, visit https://groups.google.com/d/optout.



--
Marcio Angelo Matté
marcio...@gmail.com

Rodrigo Turini

unread,
Apr 22, 2014, 12:31:44 PM4/22/14
to caelum-...@googlegroups.com
Ricardo, se quiser use o nosso projeto de teste como exemplo, o music-jungle.
Aqui o link do repositorio do projeto, e aqui do persistence.xml. Até mais, []'s

Rodrigo Turini
Caelum | Ensino e Inovação
www.caelum.com.br

Ricardo Leite

unread,
Apr 22, 2014, 1:51:31 PM4/22/14
to caelum-...@googlegroups.com
Pessoal,
  encontrei o erro, eu tinha alterado o persistence-unit name para outro nome, e na web neste link:
http://www.guj.com.br/java/146283-vraptor3-no-persistence-provider-for-entitymanager-named-default-resolvido

diz que por convenção tem que ser "default",  eu não acho isso uma boa, pois nos limita a criar um único persistence unit, tenho um projeto ejb que tenho 4 conexões diferentes.  Será que é isso mesmo?


Ricardo




--
You received this message because you are subscribed to a topic in the Google Groups "caelum-vraptor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/caelum-vraptor/1zL-iZh078k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to caelum-vrapto...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages