如何在WAS 6.1中使用javax / persistence / spi / PersistenceUnitInfo.getValidationMode() [英] How to use javax/persistence/spi/PersistenceUnitInfo.getValidationMode() with WAS 6.1

查看:684
本文介绍了如何在WAS 6.1中使用javax / persistence / spi / PersistenceUnitInfo.getValidationMode()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用了Spring的Spring JPA 2.0和hibernate。
$ b 但是,运行时为WAS 6.1。

汇编很顺利。然而,在应用程序的部署期间,我得到以下错误:

  com.ibm.ws.exception.RuntimeError:java.lang.RuntimeException:java.lang.NoSuchMethodError:javax / persistence / spi / PersistenceUnitInfo.getValidationMode()Ljavax / persistence / ValidationMode; 

在使用ctrl + shift + T搜索PersistenceUnitInfo类时,我发现它位于以下jar中:

  \IBM\SDP\runtimes\base_v61\lib\j2ee.jar 

code>

  \ WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final 

我从两个JARS中提取了上面的类,并使用JAD对它们进行了反编译以供比较。



我发现方法getValidationMode()不存在于j2ee.jar中,但存在于hibernate-jpa jar中。



这是我得到错误的原因吗?
如何解决?我如何告诉websphere在hibernate jar中寻找类而不是在服务器运行库lib中??? ???解决方案

你不能不管你做什么,使用JPA 2.0和Websphere 6.1。正如你注意到的那样,它深深地融入了WAS内部。您有两个选择:
$ b $ ol

  • 使用适当的功能包迁移到WAS 7.0(更多信息请参阅
  • 使用JPA 1.0将您的Hibernate降级至3.3.2 GA。

  • / ol>

    I am using JPA 2.0 with Spring and hibernate in my project.

    However, the runtime is WAS 6.1.

    Compilation goes fine.

    However, during deployment of the application, I get the following error:

    com.ibm.ws.exception.RuntimeError: java.lang.RuntimeException: java.lang.NoSuchMethodError: javax/persistence/spi/PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
    

    On searching for PersistenceUnitInfo class using ctrl + shift + T, I found it located in the following jars:

    \IBM\SDP\runtimes\base_v61\lib\j2ee.jar
    

    and

    \WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final
    

    I extracted above class from both the JARS and decompiled them using JAD for comparison.

    I found that method getValidationMode() is not present in j2ee.jar but is present in the hibernate-jpa jar.

    Is this the reason for the error I am getting ??? How to resolve it ?? How can I tell websphere to look for the class in the hibernate jar and not in server runtime lib ???

    解决方案

    You cannot use JPA 2.0 with Websphere 6.1, no matter what you do. As you noticed, it's wired up into the WAS internals pretty deeply. You have two options:

    1. Migrate to WAS 7.0 with appropriate feature pack (more info in my other answer).
    2. Downgrade your Hibernate to 3.3.2 GA with JPA 1.0.

    这篇关于如何在WAS 6.1中使用javax / persistence / spi / PersistenceUnitInfo.getValidationMode()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆