prb_cm
prb_cm

Reputation: 117

Unexplained NoClassDefFoundError exception

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/jdbc/core/JdbcTemplate at com.citi.cate.svn.eers.SVNEERSFeeder.loadEmpInfoFromDB(SVNEERSFeeder.java:117) at com.citi.cate.svn.eers.SVNEERSFeeder.process(SVNEERSFeeder.java:523) at com.citi.cate.svn.eers.SVNEERSFeeder.main(SVNEERSFeeder.java:631) at resources.TheApp.main(TheApp.java:39) Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.core.JdbcTemplate at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 4 more

I am unable to find the solution for the above error. lately there was change in the spring-framework version and i changed all the jars related to the new version of spring-framework. i see the above error. tried to reload all the jars.still the error exists. please help me on this.

SVNEERSFeeder.java

line 117: JdbcTemplate jt = new JdbcTemplate(_utility.getDBConnection("csi", ""))

Upvotes: 1

Views: 2547

Answers (1)

CrawlingKid
CrawlingKid

Reputation: 994

The exception is caused due to misconfiguration of appropriate spring jdbc jars related to the spring version. To resolve dependencies easily, you could use maven: For example, if you are using spring 4.2.5, add spring jdbc dependencies in maven as follows:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>4.2.5.RELEASE</version>
</dependency>

Apache Ivy Dependencies:

<dependency org="org.springframework" name="spring-jdbc" rev="4.2.5.RELEASE"/>

Upvotes: 2

Related Questions