Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error on Spring startup with Spring Jersey JPA Hibernate app, NoClassDefFoundError  RSS feed

 
Kim Woodside
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to start up a jersey-spring-jpa-hibernate app. I am getting the following error

nested exception is java.lang.NoClassDefFoundError: org/springframework/dao/support/PersistenceExceptionTranslator
May 05, 2017 2:51:19 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed here

However, when I look in my maven repository, I can see the class in the spring-tx jar :

~/.m2/repository/org/springframework/spring-tx/4.3.8.RELEASE/spring-tx-4.3.8.RELEASE/org/
springframework/dao/support/PersistenceExceptionTranslator.class


I believe this may be due to problems in my pom file but I can not seem to track it down.

My pom file is as follows:

My jpaContext.xml :

Any help would be greatly appreciated, thank you!
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15861
81
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you are using a library, jersey-spring3, which was made for the Spring Framework version 3.x, while you are using Spring version 4.3.8.

It's possible that the class org.springframework.dao.support.PersistenceExceptionTranslator in Spring 4.3.8 looks different than what something in jersey-spring3 expects.

There is also a jersey-spring4. It sounds like you should be using that instead of jersey-spring3 if you are using Spring version 4.x.
 
Kim Woodside
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for taking the time to answer.

It turned out that I had a classpath problem. 
I had assumed since my classes were packed up into my war in my application's lib folder, that tomcat would load them. When I added the path to the jar to my classpath, this error went away.

I am wondering if there is a tomcat configuration I missing that made me have to manually add the jar to my classpath.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!