且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

创建bean实体管理器工厂时出错,NoSuchMethodError:javax/persistence/Table.indexes

更新时间:2023-01-15 08:32:41

您遇到以下错误.

Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/Table.indexes()ÝLjavax/persistence/Index;

此错误表明必需的方法在特定类中不可用. JPA 2.1 jar(hibernate-jpa-2.1-api)的"javax.persistence.Table"类中提供了"indexes()"方法.一些在您的部署中如何使用JPA 2.0 jar(hibernate-jpa-2.0-api)在Table类中没有此方法的情况.在pom.xml中,您使用的是"hibernate-entitymanager 4.3.7.Final",它提供了JPA 2.1 jar文件.请在获取此错误的服务器中查找JPA 2.0 jar文件.

This error is indicating that required method is not available in the particular class. The "indexes()" method is available at "javax.persistence.Table" class of JPA 2.1 jar (hibernate-jpa-2.1-api). Some how in your deployment it is picking up JPA 2.0 jar (hibernate-jpa-2.0-api) which doesn't have this method in Table class. In your pom.xml you are using "hibernate-entitymanager 4.3.7.Final", which provides JPA 2.1 jar file. Please look for the JPA 2.0 jars file in your server where you are getting this error.