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

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

Вопрос

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"

Это было полезно?

Решение

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.

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top