简体   繁体   English

启动服务时出现JPA休眠错误

[英]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服务:

  • jpa-container picks up your bundle with the persistence.xml and creates an Entity manager factory jpa-container使用persistence.xml拾取捆绑包,并创建一个实体管理器工厂
  • 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 jpa-container-context拾取每个EntityManagerFactory服务,并使用(org.apache.aries.jpa.proxy.factory = true)服务属性键值对创建新的托管EntityManagerFactory服务。

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 aries-jpa-container-context不在您的OSGi环境中,也不处于ACTIVE状态
  • The original EntityManagerFactory service is not registered as some dependency is missing 原始EntityManagerFactory服务未注册,因为缺少某些依赖项

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 / runco​​nsole.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.

相关问题 我在jpa-hibernate中有错误“无会话” - i have error “no Session” in jpa-hibernate 主外键的JPA-Hibernate映射 - JPA-Hibernate mapping of primary foreign key JPA-Hibernate:OneToOne和ManyToOne JoinColumns上的UniqueConstraint - JPA-Hibernate: UniqueConstraint on OneToOne & ManyToOne JoinColumns 当懒惰的子级被另一个事务删除时的JPA休眠行为 - JPA-Hibernate behaviour when a Lazy child is deleted by another transaction JPA-Hibernate-“无法通过继承的反射获取器获取字段值 - JPA-Hibernate - “could not get a field value by reflection getter of with inheritance 如何在 JPA-Hibernate 中使用嵌套的 collections 避免 LazyInitializationException? - How to avoid LazyInitializationException with nested collections in JPA-Hibernate? JPA-Hibernate:抽象类集合引发“对象引用未保存的瞬时实例”异常 - JPA-Hibernate : Abstract class collection raises “object references an unsaved transient instance” exception 在JPA-hibernate中通过非主键进行一对多关联的任何方式 - Any way to do one-to-many association by non primary key in JPA-hibernate 如何在 java spring 启动(jpa-hibernate)中保存(分离的)对象的关系 - How to save relationship of (detached) objects in java spring boot (jpa-hibernate) 在Web应用程序中启动Hibernate Search时出错 - Error while starting Hibernate Search in Web app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM