启动服务时出现Jpa-hibernate错误 [英] Jpa-hibernate error while starting the service
问题描述
以下是我在启动服务后看到的日志错误...您可以帮助解决此问题吗?
2013-08-22 10:35:37,111 | DEBUG | l控制台线程| AbstractServiceReferenceRecipe | r.AbstractServiceReferenceRecipe 143 | 7 - org.apache.aries.blueprint.core - 1.1.0 |找到OSGi服务的初始引用null(&(&(org.apache.aries.jpa.proxy.factory = true)(osgi.unit.name = tenant))(objectClass = javax.persistence.EntityManagerFactory))
2013-08-22 10:35:37,111 | DEBUG | l控制台线程| BlueprintContainerImpl | container.BlueprintContainerImpl 280 | 7 - org.apache.aries.blueprint.core - 1.1.0 |在状态WaitForInitialReferences中运行包com.igt.arcus.framework.jta.arcus-framework-feature-service的蓝图容器
2013-08-22 10:35:37,111 | INFO | l控制台线程| BlueprintContainerImpl | container.BlueprintContainerImpl 344 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Bundle com.igt.arcus.framework.jta.arcus-framework-feature-service正在等待依赖项[(&(&(org.apache.aries.jpa.proxy.factory = true)(osgi.unit.name = tenant))(objectClass = javax.persistence.EntityManagerFactory))]
2013-08-22 10:35:37,112 | DEBUG | l控制台线程| BlueprintEventDispatcher | ntainer.BlueprintEventDispatcher 136 | 7 - org.apache.aries.blueprint.core - 1.1.0 |发送蓝图容器事件BlueprintEvent [type = GRACE_PERIOD,dependencies = [(&(&(org.apache.aries.jpa.proxy.factory = true)(osgi.unit.name = tenant))(objectClass = javax.persistence .EntityManagerFactory))]] for package com.igt.arcus.framework.jta.arcus-framework-feature-service
如果您使用Aries JPA,您应该看到两个EntityManagerFactory服务:
第二个在您的环境中不存在。可能有两个原因:
li>
打开OSGi控制台并检查可用的服务。如果根本没有EntityManagerFactory服务,那么第二个是你的问题。
检查你的所有bundle是否活动!如果是,请检查是否有jpa-container需要的所有服务:TransactionManager,DataSource或DataSourceFactory以及用于Hibernate的javax.persistence.spi.PersistenceProvider服务。如果有任何服务缺少aries-jpa-container将会收到你的bundle,但永远不会创建EntityManagerFactory。
我实现了一个自己的jpa-container,与aries-jpa-container相同的方式。如果你替换aries-jpa-container(只有那个,jpa-container-context应该放在那里),它会在INFO级别为你记录更多的消息。该容器可用此处。使用hibernate的示例应用程序可在 https://github.com/everit-org/ OSGi的休眠。运行mvn install后,你会发现它的子目录/ core / target / eosgi-itests-dist / equinox,你可以在equinox服务器上用bin / runconsole.sh启动工作应用程序。
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:
- jpa-container picks up your bundle with the persistence.xml and creates an Entity manager factory
- jpa-container-context picks up every EntityManagerFactory service and makes a new managed EntityManagerFactory service with the (org.apache.aries.jpa.proxy.factory=true) service property key-value pair
The second does not exist in your environment. There can be two causes:
- aries-jpa-container-context is not in your OSGi environment or it is not in ACTIVE state
- The original EntityManagerFactory service is not registered as some dependency is missing
You can check it if you open an OSGi console and check what services available. If there is no EntityManagerFactory service at all, the second is your problem.
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. If any of the services are missing aries-jpa-container will pick up your bundle but will never create the EntityManagerFactory.
I implemented an own jpa-container that works almost the same way as 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. The container is available here. A sample application is available that uses hibernate is available at 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.
这篇关于启动服务时出现Jpa-hibernate错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!