[英]Jpa-hibernate error while starting the service
Below is the error from the log that i see after starting the service... can you help resolving this issue. 以下是启动服务后看到的日志错误...您能帮助解决此问题吗?
2013-08-22 10:35:37,111 | DEBUG | l Console Thread | AbstractServiceReferenceRecipe | r.AbstractServiceReferenceRecipe 143 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Found initial references null for OSGi service (&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=tenant))(objectClass=javax.persistence.EntityManagerFactory))
2013-08-22 10:35:37,111 | DEBUG | l Console Thread | BlueprintContainerImpl | container.BlueprintContainerImpl 280 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Running blueprint container for bundle com.igt.arcus.framework.jta.arcus-framework-feature-service in state WaitForInitialReferences
2013-08-22 10:35:37,111 | INFO | l Console Thread | BlueprintContainerImpl | container.BlueprintContainerImpl 344 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Bundle com.igt.arcus.framework.jta.arcus-framework-feature-service is waiting for dependencies [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=tenant))(objectClass=javax.persistence.EntityManagerFactory))]
2013-08-22 10:35:37,112 | DEBUG | l Console Thread | BlueprintEventDispatcher | ntainer.BlueprintEventDispatcher 136 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Sending blueprint container event BlueprintEvent[type=GRACE_PERIOD, dependencies=[(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=tenant))(objectClass=javax.persistence.EntityManagerFactory))]] for bundle com.igt.arcus.framework.jta.arcus-framework-feature-service
In case you use Aries JPA you should see two EntityManagerFactory services: 如果您使用Aries JPA,则应该看到两个EntityManagerFactory服务:
The second does not exist in your environment. 第二个在您的环境中不存在。 There can be two causes:
可能有两个原因:
You can check it if you open an OSGi console and check what services available. 如果打开OSGi控制台并检查可用的服务,则可以检查它。 If there is no EntityManagerFactory service at all, the second is your problem.
如果根本没有EntityManagerFactory服务,第二个是您的问题。
Check if all of your bundles are active! 检查所有捆绑包是否都处于活动状态! If they are, check if you have all the services that jpa-container needs: TransactionManager, DataSource or DataSourceFactory and a javax.persistence.spi.PersistenceProvider service for Hibernate.
如果是,请检查是否具有jpa-container所需的所有服务:TransactionManager,DataSource或DataSourceFactory以及用于Hibernate的javax.persistence.spi.PersistenceProvider服务。 If any of the services are missing aries-jpa-container will pick up your bundle but will never create the EntityManagerFactory.
如果缺少任何服务,aries-jpa-container将会拾取您的捆绑包,但将永远不会创建EntityManagerFactory。
I implemented an own jpa-container that works almost the same way as aries-jpa-container. 我实现了自己的jpa容器,其工作方式与aries-jpa-container几乎相同。 If you replace the aries-jpa-container (only that one, the jpa-container-context should be left there) it will log more messages at INFO level for you what is missing.
如果替换aries-jpa-container(仅保留一个,则应在其中保留jpa-container-context),它将为您记录更多信息,以供您参考。 The container is available here .
容器在这里可用。 A sample application is available that uses hibernate is available at https://github.com/everit-org/osgi-hibernate .
https://github.com/everit-org/osgi-hibernate上提供了一个使用休眠的示例应用程序。 After running "mvn install" you will find itests/core/target/eosgi-itests-dist/equinox a subfolder where you can start the working application with on equinox server with bin/runconsole.sh.
运行“ mvn install”后,您会发现itests / core / target / eosgi-itests-dist / equinox一个子文件夹,您可以在其中用bin / runconsole.sh在Equinox服务器上启动正在运行的应用程序。
The current aries jpa container jar 1.0.0 has a bug that makes it swallow exceptions on creating the EntityManager. 当前的白羊座jpa容器jar 1.0.0有一个错误,使它在创建EntityManager时吞下了异常。 A colleague of me opened the aries bug: https://issues.apache.org/jira/browse/ARIES-1160
我的一位同事打开了白羊座的bug: https ://issues.apache.org/jira/browse/ARIES-1160
I created a second patch that can be applied to the 1.0.0 sources to create a jar that correctly logs the exception. 我创建了第二个补丁,该补丁可以应用于1.0.0源,以创建一个可以正确记录异常的jar。 Check out the 1.0.0 tag of aries jpa container, apply the patch and build.
签出aries jpa容器的1.0.0标签,应用补丁并构建。
When you then run in karaf you should see the real source of the error. 然后在karaf中运行时,您应该会看到错误的真正来源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.