1
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
    at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
    at org.apache.commons.httpclient.methods.ExpectContinueMethod.<init>(ExpectContinueMethod.java:93)
    at org.apache.commons.httpclient.methods.EntityEnclosingMethod.<init>(EntityEnclosingMethod.java:119)
    at org.apache.commons.httpclient.methods.PostMethod.<init>(PostMethod.java:106)
    at SMSServiceJava.CSoftHttpClientSMSService.sendSimpleSMS(CSoftHttpClientSMSService.java:113)
    at SMSServiceJava.CSoftHttpClientSMSService.main(CSoftHttpClientSMSService.java:219)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 6 more

whenever I am running the program in eclipse I am getting the above mentioned exception. whenever I already been passed the relevant package in my classpath. can anyone tell me how to resolve this?

Damodaran
  • 10,882
  • 10
  • 60
  • 81
Deepu
  • 11
  • 7

5 Answers5

1

You need commons-codec.jar on your classpath.

Reference: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException

Community
  • 1
  • 1
DanielBarbarian
  • 5,093
  • 12
  • 35
  • 44
1

Add the jar(Commons-codec.jar) file needed for this org.apache.commons.codec.DecoderException

Download it from here and put it in classpath

http://commons.apache.org/proper/commons-codec/download_codec.cgi

Bilbo Baggins
  • 2,899
  • 10
  • 52
  • 77
0

Please make sure that org-apache-commons-codec.jar is present on your class-path. You can download this commons-codec jar file from apache website.
This jar file contains org/apache/commons/codec/DecoderException class, and hence add it to the classpath must resolve your problem.

Ankur Shanbhag
  • 7,746
  • 2
  • 28
  • 38
0

NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time. For example if we have a method call from a class or accessing any static member of a Class and that class is not available during run-time then JVM will throw NoClassDefFoundError.

For more

Rakesh KR
  • 6,357
  • 5
  • 40
  • 55
0

Try to include commons-codec-XXX.jar.

Mudit Shukla
  • 814
  • 2
  • 6
  • 16