Java 冬眠&;OSGi中的H2,缺少持久性提供程序

Java 冬眠&;OSGi中的H2,缺少持久性提供程序,java,database,hibernate,osgi,h2,Java,Database,Hibernate,Osgi,H2,我正在开发一个需要数据库的OSGi应用程序。 我选择对我的数据库使用H2和Hibernate EntityManager无法找到名为“test”的持久性文件。我不相信PersistenceProvider没有运行。在没有OSGI但作为MavenProject运行时,我不会遇到这个错误 这是控制台输出: Java热点(TM)64位服务器虚拟机警告:忽略选项MaxPermSize=256m;支持在8.0中被删除 osgi>错误状态记录器Log4j2找不到日志记录实现。请将log4j核心添加到类路径

我正在开发一个需要数据库的OSGi应用程序。 我选择对我的数据库使用H2和Hibernate

EntityManager无法找到名为“test”的持久性文件。我不相信PersistenceProvider没有运行。在没有OSGI但作为MavenProject运行时,我不会遇到这个错误

这是控制台输出:

Java热点(TM)64位服务器虚拟机警告:忽略选项MaxPermSize=256m;支持在8.0中被删除
osgi>错误状态记录器Log4j2找不到日志记录实现。请将log4j核心添加到类路径。正在使用SimpleLogger登录到控制台。。。
初始SessionFactory创建失败。javax.persistence.PersistenceException:没有名为test的EntityManager的持久性提供程序
!会议2015-05-11 09:22:14.196-----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_25
java.vendor=Oracle公司
引导加载程序常量:OS=macosx,ARCH=x86_64,WS=cocoa,NL=de_de
命令行参数:-dev file:/Users/christianverdio/Documents/workspace/HibernateH2OSGi/.metadata/.plugins/org.eclipse.pde.core/HibernateH2OSGi/dev.properties-os macosx-ws-cococoa-arch x86_64-consoleLog-console
!冬眠冬眠201505-1109:22:16.029
!消息框架事件错误
!堆栈0
org.osgi.framework.BundleException:捆绑包hibernateh2osgi的hibernateh2osgi.Activator.start()中的异常。
位于org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)
位于org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
位于org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
位于org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
位于org.eclipse.osgi.container.Module.doStart(Module.java:571)
位于org.eclipse.osgi.container.Module.start(Module.java:439)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
位于org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
位于org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
原因:java.lang.ExceptionInInitializeError
在hibernateh2osgi.EntityManagerUtil.(EntityManagerUtil.java:16)
在hibernateh2osgi.DataProviderImpl.(DataProviderImpl.java:15)
在hibernateh2osgi.Activator.start(Activator.java:32)
位于org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
位于org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
位于java.security.AccessController.doPrivileged(本机方法)
位于org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
... 还有12个
原因:javax.persistence.PersistenceException:没有名为test的EntityManager的持久性提供程序
位于javax.persistence.persistence.createEntityManagerFactory(persistence.java:61)
位于javax.persistence.persistence.createEntityManagerFactory(persistence.java:39)
在hibernate2osgi.EntityManagerUtil.(EntityManagerUtil.java:12)
... 还有18个
根异常:
java.lang.ExceptionInInitializeError
在hibernateh2osgi.EntityManagerUtil.(EntityManagerUtil.java:16)
在hibernateh2osgi.DataProviderImpl.(DataProviderImpl.java:15)
在hibernateh2osgi.Activator.start(Activator.java:32)
位于org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
位于org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
位于java.security.AccessController.doPrivileged(本机方法)
位于org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
位于org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
位于org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
位于org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
位于org.eclipse.osgi.container.Module.doStart(Module.java:571)
位于org.eclipse.osgi.container.Module.start(Module.java:439)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
位于org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
位于org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
位于org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
原因:javax.persistence.PersistenceException:没有名为test的EntityManager的持久性提供程序
位于javax.persistence.persistence.createEntityManagerFactory(persistence.java:61)
位于javax.persistence.persistence.createEntityManagerFactory(persistence.java:39)
在hibernate2osgi.EntityManagerUtil.(EntityManagerUtil.java:12)
... 还有18个
!条目org.eclipse.osgi 4 0 2015-05-11 09:22:16.239

!消息包hibernateh2osgi_1.0.0.qualifier[36]未处于活动状态。
因此您正在使用static Persistence.createEntityManagerFactory创建EntityManagerFactory。当我阅读jpa提供者spe时