Невозможно создать EntityManager из действительного файла persistence.xml. - PullRequest
2 голосов
/ 04 марта 2012

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

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 действителен, но фабрика не может быть создана:

* * 1010

1 Ответ

1 голос
/ 29 апреля 2012

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

...