Invocation of init method failed;
nested exception is java.lang.NoSuchMethodError:
javax.persistence.Table.indexes()[Ljavax/persistence/Index;
此问题是由于jar 包引起的包冲突
1、hibernate4.3 需要hibernate-jpa 2.1,如果版本不一样请替换
2、查看引用的jar 包中是否有其他包包含javax.persistence.Table
参考:https://my.oschina.net/JasonZhang/blog/539095 这个分析还是很透彻的
3、weblogic 自带包冲突;解决办法在web-inf目录下添加weblogic.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">
<wls:weblogic-version>10.3.6</wls:weblogic-version>
<!--解决与weblogicjar 冲突问题-->
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>javax.persistence.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
个人资料收集资料时遇到的:
在找寻问题解决方案中,看到很多说改@Table == > @Entity 的,个人觉得还是欠妥。
还有说改jee6成jee7,问题weblogic 10.3.X 版本好像不支持jee7(本人测试版本10.3.6并不支持)
还有weblogic.xml文件改成如下:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">
<wls:weblogic-version>10.3.6</wls:weblogic-version>
<wls:container-descriptor>
<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>
</wls:weblogic-web-app>
并没有解决我的问题,不知道是不是我的问题,因为一些原因没有细究了,欢迎大家指导、分享。