Follow by Email

Monday, August 4, 2014

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream

I was getting this error in my eclipse project , pressing ctrl+t and finding for this class I found that it was avaialable in one of my jar files in the maven m2 directory under below jar file

commonns-io-2.1.jar

So I was considering that it is in my class path already , but I was wrong.

I soon found out that the dependency related to this jar file in my pom was mistakenly commented out and because of that the jar file was not included in my war.

so I uncommented the below dependency in my pom file

  <dependency>
   <groupId>commons-io</groupId>
   <artifactId>commons-io</artifactId>
   <version>2.1</version>
  </dependency>
and recompiled the project nd nwo it's running fine.
 

Summary:

NoClassDefFoundError means the related jar is not in your classpath and ctrl+t shows you only to which jar file a class belongs to . it doesn't mean that the jar file is in your classpath ( It's a reminder for myself :)  ) .

2 comments:

  1. Thanks a lot. It helped me out from my prob.

    ReplyDelete
    Replies
    1. You are welcome bro , it is always wonderful to see my blog is helping some one out there :)

      Delete