简体   繁体   中英

java.lang.NoClassDefFoundError: org/apache/tomcat/util/codec/binary/Base64

When I click a particular radio button it should fetch a servlet but it is not able to find the above class. Where should I include the class path of the jar file? Also what are the jar files that has to be present tomcat-util.jar catalina-ant.jar commons-codec-1.6.jar opencsv-2.1-1.0.0.jar xerces_2_6_2.jar

Should I include them in the manifest.mf in META-INF? Please help me as I am struck with this for a long time now.

Thank you All for the suggestions. I just figured out that my .classpath in the project did not have the jar files location .

    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/catalina-ant.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/tomcat-util.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-codec-1.6.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/opencsv-2.1-1.0.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/xerces-2_6_2.jar"/>

i added the above and it solved my problem. Thank you so much All.:)

java.lang.NoClassDefFoundError is, indeed, a "garbage exception" that usually gets thrown when your code was compiled with one version of the class and at runtime a different incompatible version is found by the class loader. "Usually" is the operative term there. Failure of static initializers is also a common source of this issue.

You can probably get around this by getting whatever JAR you used to compile your stuff into the WEB-INF/lib directory of your webapp. If you are using Gradle or Maven I believe they will do this directly if you declare the dependency to be a compile dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM