How to use javax/persistence/spi/PersistenceUnitInfo.getValidationMode() with WAS 6.1

一个人想着一个人 提交于 2019-12-20 01:11:25

问题


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 ???


回答1:


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.


来源:https://stackoverflow.com/questions/7792963/how-to-use-javax-persistence-spi-persistenceunitinfo-getvalidationmode-with-wa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!