No Such Method Error

Hello,
I am trying to upgrade to hibernate v5.3.3 and I am receiving the error:

nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;

The dependencies I am using are

antlr-2.7.7.jar
aopalliance-1.0.jar
backport-util-concurrent-2.2.jar
cfgatewayadapter.jar
cglib-nodep-2.1.jar
com.springsource.org.aopalliance-1.0.0.jar
commons-beanutils-1.8.0.jar
commons-codec-1.3.jar
commons-dbcp-1.4.jar
commons-digester-2.0.jar
commons-fileupload-1.2.2.jar
commons-httpclient-3.0.1.jar
commons-io-1.4.jar
commons-lang3-3.2.1.jar
commons-logging-1.1.1.jar
commons-logging.jar
commons-net-3.3.jar
commons-pool-1.5.4.jar
controlsfx-8.20.8.jar
dom4j-1.6.1.jar
geronimo-stax-api_1.0_spec-1.0.jar
hessian-4.0.37.jar
jackson-core-asl-1.9.6.jar
jackson-mapper-asl-1.9.6.jar
javaee.jar
javassist-3.4.GA.jar
javaws.jar
jfxrt.jar
jsch-0.1.50.jar
jstl.jar
jtds-1.2.4.jar
junit-4.8.1.jar
log4j-1.2.15.jar
mail.jar
mysql-connector-java-5.1.24-bin.jar
quartz-all-1.7.1.jar
servlet-api.jar
sqljdbc4.jar
standard.jar
struts1.2.6.jar
xalan.jar
xmlbeans-2.3.0.jar
commons-collections4-4.1.jar
javax.persistence-api-2.2.jar
commons-collections.jar
commons-codec-1.9.jar
commons-logging-1.2.jar
httpclient-4.5.3.jar
httpcore-4.4.6.jar
json-20170516.jar
spring-aop-4.3.18.RELEASE.jar
spring-aspects-4.3.18.RELEASE.jar
spring-beans-4.3.18.RELEASE.jar
spring-context-4.3.18.RELEASE.jar
spring-context-support-4.3.18.RELEASE.jar
spring-core-4.3.18.RELEASE.jar
spring-expression-4.3.18.RELEASE.jar
spring-instrument-4.3.18.RELEASE.jar
spring-instrument-tomcat-4.3.18.RELEASE.jar
spring-jdbc-4.3.18.RELEASE.jar
spring-jms-4.3.18.RELEASE.jar
spring-orm-4.3.18.RELEASE.jar
spring-oxm-4.3.18.RELEASE.jar
spring-test-4.3.18.RELEASE.jar
spring-tx-4.3.18.RELEASE.jar
spring-web-4.3.18.RELEASE.jar
spring-webmvc-4.3.18.RELEASE.jar
spring-webmvc-portlet-4.3.18.RELEASE.jar
spring-websocket-4.3.18.RELEASE.jar
jboss-logging-3.3.2.Final.jar
slf4j-api-1.7.25.jar
slf4j-log4j12-1.7.25.jar
byte-buddy-1.8.14.jar
log4j-core-2.11.0.jar
classmate-1.4.0.jar
hibernate-commons-annotations-5.0.4.Final.jar
ehcache-3.5.2.jar
ehcache-core-1.7.2.jar
javax.activation-api-1.2.0.jar
jboss-transaction-api_1.2_spec-1.1.1.Final.jar
hibernate-ehcache-5.3.3.Final.jar
hibernate-core-5.3.3.Final.jar

From looking online, the issue seems to be a duplicate dependency issue with jpa but I only have jpa included once.
It might be because it has to do with the order? Should spring go before hibernate in eclipse?
Any advice to resolve this issue? Thanks.

You need to update the JPA jar to 2.1 or 2.2 as well. Maybe it’s supplied by the application server.

Hi vlad,
I updated the post above because my list got cut off but I am using javax.persistence-api-2.2.jar
Do you think it could be because of the order?

Check out this StackOverflow answer:

Hi vlad,
I am not using play-java-jpa. The exact error I am getting is:

Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
	at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1236)
	at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:833)
	at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:250)
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:231)
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:274)
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:84)
	at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:474)
	at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:85)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:689)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
	at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:511)
	at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:495)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1692)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1630)
	... 22 more

I don’t see any of these dependencies overlapping so I am not too sure what else it could be.

If you debug it, you will see the dependency causing the issue. The StackOverflow answer is universal even if you don’t use Play.