java.lang.NoSuchMethodError: javax/persistence/spi/PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode

家住魔仙堡 提交于 2019-11-29 10:52:44

Add this to your weblogic.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app ...>
    ...
    <container-descriptor>
        <prefer-application-packages>
            <package-name>antlr.*</package-name>
            <package-name>org.hibernate.*</package-name>
            <package-name>javax.persistence.*</package-name>
        </prefer-application-packages>
    </container-descriptor>
</weblogic-web-app>

I tried with the <prefer-web-inf-classes>true</prefer-web-inf-classes>, with no luck. I'm using Weblogic 11g (10.3.6), Hibernate 4.1.9 and Spring 3.2.1. With this, persistence works like a charm!

Source here.

Add a weblogic.xml file to the web-inf and place the following in it

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
</weblogic-web-app>`

It could also mean that the dependency you are including may be dependent on an incompatible dependency with your project. for example.. in maven you can do use the "exclusions" tag to not package the offending dependency in your war by doing something like this:

<dependency>
    <groupId>com.ibm.websphere</groupId>
    <artifactId>wxsutils</artifactId>
    <version>2.5.4-SNAPSHOT</version>
            <exclusions>
                  <exclusion>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-jpa_3.0_spec</artifactId>
                 </exclusion>
            </exclusions>
</dependency>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!