2017年5月4日 星期四

JPA Error Code: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;

From: Polin Wei

If you are using Jboss 7.1.1, jboss already has hibernate-jpa-2.0 in its classpath, so during runtime it uses the one in its classpath, not the one you've deployed with your app , to point jboss to the hibernate-jpa-2.1 do the following:
  1. copy to the following directory : jboss-as-7.1.1.Final/modules/javax/persistence/api/main
  2. open module.xml and change the resource-root as follows : resource-root path="" (pointing it to jpa 2.1)
  3. re-compile and re-deploy your app, then you are good to go.