ClassNotFoundException-org-apache-commons-codec-DecoderException

ClassNotFoundException-org-apache-commons-codec-DecoderException

Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException

If you see below exception:

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
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 org.springframework.ws.transport.http.CommonsHttpMessageSender.createConnection(CommonsHttpMessageSender.java:228)
    at org.springframework.ws.client.support.WebServiceAccessor.createConnection(WebServiceAccessor.java:107)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:533)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:384)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:378)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:370)
    at com.javahonk.client.TestWebService.main(TestWebService.java:30)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 11 more

 

Solution: This happens if commons-codec-x.x.jar is missing from your class path. Please add commons-codec-1.7.jar or latest version to your class path to fix this issue.

Leave a Reply

Your email address will not be published. Required fields are marked *