【问题标题】:The annotation PersistenceContext will not be recognized by WebSphere Application Server v7.0 runtimesWebSphere Application Server v7.0 运行时将无法识别注解 PersistenceContext
【发布时间】:2011-10-05 13:58:03
【问题描述】:

尝试使用 JPA @PersistenceContext 注释时,我在 Websphere 中收到错误消息。

我使用 JPA 2.0 和 hibernate 作为持久性提供程序,在类路径中有所有必需的 hibernate 3.5 jar 文件。

为什么会出现这个错误信息?

问题描述:注解 PersistenceContext 将不会被识别 WebSphere Application Server v7.0 运行时。设置 使用 EJB61FEPScanPolicy 自定义属性为 true 此模块的 MANIFEST.MF 文件。

【问题讨论】:

  • 您是否设置了 标记并将 Classloader 策略修改为描述的here?

标签: hibernate jpa websphere


【解决方案1】:

看起来 WebSphere 将您的应用程序视为 J2EE,而不是 Java EE 5。检查您的 EAR (application.xml) 和 EJB jar 的部署描述符,如果它们符合 Java EE 5。

编辑:如果您的 WAS 未使用“OSGI 和 JPA 2 功能包”进行扩展,您的 Hibernate 版本也可能是原因。 Hibernate 3.5 实现了 JPA 2.0,Hibernate 3.3 — JPA 1.0(见我的other answer)。

【讨论】:

    猜你喜欢
    • 2012-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-25
    • 2021-08-21
    • 1970-01-01
    相关资源
    最近更新 更多