2012-03-04 2 views
2

Я пытаюсь использовать JPA из приложения Scala Play 2.0 Scala. В моем коде у меня есть:Невозможно создать EntityManager из действительного persistence.xml

val factory = Persistence.createEntityManagerFactory("devcrowd") 

У меня также есть persistence.xml в пакете META-INF:

<?xml version="1.0" encoding="UTF-8"?> 
<persistence 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_2_0.xsd" version="2.0"> 
<persistence-unit name="devcrowd" transaction-type="RESOURCE_LOCAL"> 
    <provider>org.hibernate.ejb.HibernatePersistence</provider> 
    <properties> 
     <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> 
     <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/> 
     <property name="hibernate.connection.username" value="xxxx"/> 
     <property name="hibernate.connection.password" value="xxxx"/> 
     <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/devcrowd"/> 
    </properties> 
</persistence-unit> 
</persistence> 

Это persistence.xml кажется действительным для меня, но завод не может быть создан:

PersistenceException: No Persistence provider for EntityManager named devcrowd 
+0

Чтобы уменьшить трассировку стека. Проверьте, находится ли postgresql jdbc в пути к классам. –

+0

И спящий режим, если на то пошло. –

ответ

1

Вам не хватает библиотеки Hibernate во время развертывания.

Смежные вопросы