Tomcat but not Jetty: NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey

StackOverflow https://stackoverflow.com/questions/23513830

Question

I have recently upgraded my Wicket 6 application from Spring 3 to Spring 4.

When I run the application locally on Jetty 7, it runs fine.

When I deploy it to Tomcat 7, I get the following error:

[2014-05-07 10:20:47,121] ERROR [org.springframework.web.context.ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;

Is this a Tomcat issue or should I just go ahead and try to solve the nested exception java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()?

If the issue is indeed with the foreignKey, then why does the problem not occur on Jetty?

spring.version 4.0.4.RELEASE

hibernate.version 4.3.5.Final

dataSource: class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"

Was it helpful?

Solution

nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey

This exception occurs of there are conflicting version of javax.persistence.ForeignKey class. Check your classpath and if you are using maven check the dependencies.

OTHER TIPS

For me, issue fixed after downgrading my project to java 6 and hibernate-entitymanager version to 3.6.9.FINAL

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top