• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic