Servicemix 7 Hibernate 5 javax.persistence.PersistenceException:EntityManager没有持久性提供程序

时间:2019-06-27 12:20:48

标签: hibernate apache-servicemix persistence.xml

我正在使用Servicemix7。我正在尝试在我的项目中使用Hibernate实现的JPA。 我已经在Servicemix中安装了hibernate-release-5.2.16。

META-INF / persistence.xml

<?xml version="1.0" encoding="UTF-8"?>

http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd“ version =” 2.0“>     

    <properties>
        <property name="hibernate.hbm2ddl.auto" value="create-drop" />
        <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver" />

        <property name="javax.persistence.jdbc.url"
            value="jdbc:oracle:thin:@localhost:1521:orcl2" />
        <property name="javax.persistence.jdbc.user" value="Nuernberg" />
        <property name="javax.persistence.jdbc.password" value="Nuernberg" />
    </properties>
</persistence-unit>

来自MANIFEST.MF

Manifest-Version: 1.0
Bnd-LastModified: 1561634626730
Build-Jdk: 1.8.0_181
Built-By: ..
Bundle-ManifestVersion: 2
Bundle-Name: ..
Bundle-SymbolicName: ..
Bundle-Version: 1.0.0
Created-By: Apache Maven Bundle Plugin
Export-Package: ..
Meta-Persistence: META-INF/persistence.xml
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-2.3.0.201405100607

Java代码:

private final static EntityManagerFactory emf = Persistence.createEntityManagerFactory("Nuernberg");

我知道

Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named Nuernberg
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:61)[260:org.hibernate.javax.persistence.hibernate-jpa-2.1-api:1.0.0.Final]
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:39)[260:org.hibernate.javax.persistence.hibernate-jpa-2.1-api:1.0.0.Final]
        at de.iteos.egov.advisadaptor.persistence.PersistenceFactory.<clinit>(Pe
rsistenceFactory.java:9)[241:adivstadaptor:1.0.0]

0 个答案:

没有答案