If you are using Jboss 7.1.1, jboss already has
http://stackoverflow.com/questions/26616723/java-lang-nosuchmethoderror-javax-persistence-table-indexesljavax-persistenchibernate-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: - copy
hibernate-jpa-2.1-api-1.0.0.final.jarto the following directory :jboss-as-7.1.1.Final/modules/javax/persistence/api/main - open
module.xmland change the resource-root as follows :resource-root path="hibernate-jpa-2.1-api-1.0.0.final.jar"(pointing it to jpa 2.1) - re-compile and re-deploy your app, then you are good to go.
(繼續閱讀...)