1

I have tried placing the commons-codec-1.10.jar in /TOMCAT/lib/ folder and running Tomcat but I still get the same error message when launching the applet. I don't get the same error when running the code outside of Tomcat. This is basically a change in the code from an older version of commons-codec-1.3.jar to a commons-codec-1.10.jar when changing from DES to AES.


java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
at com.att.uview.misc.Base64Coder.encryptString(Base64Coder.java:33)
at com.att.uview.tree.RingContextTree.createTree(RingContextTree.java:263)
at com.att.uview.main.UltraView.loadUView(UltraView.java:529)
at com.att.uview.main.UltraView.init(UltraView.java:442)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more

Ignored exception: java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
  • have you removed the older version ? 1.3 ? – AntJavaDev Dec 04 '16 at 12:54
  • I have tried running without copying the commons-codec-1.10.jar into the tomcat lib folder. I wonder if I can grab that tomcat jar that includes their version of the Base64 class and import that into code and compile. – Seymour Butts Dec 04 '16 at 12:56
  • try placing the newer version , because from the stacktrace you posted, it seems that only your app is looking for this version of the class. Have you tried exporting your app along with its libraries? How you run it outside Tomcat ? Inside a dir with the libraries , or you package the libraries inside the jar – AntJavaDev Dec 04 '16 at 12:57
  • Do you mean putting the commons-codec-1.10.jar in some place other than tomcat/lib/ folder? – Seymour Butts Dec 04 '16 at 13:00
  • Tomcat7 has the tomcat-util.jar in the /lib/ folder, but it doesn't include this Base64 class so I am really not sure there is a conflict unless it's included in another tomcat jar file. – Seymour Butts Dec 04 '16 at 13:49
  • @AntJavaDev - I am able to compile an run successfully my encrypt/decrpyt class with the commons-codec-1.10.jar on a linux server just by itself. The only version of commons-codec found on the tomcat server is the latest 1.10 version. – Seymour Butts Dec 04 '16 at 13:52
  • Applet code runs into the JVM of the client side. The tomcat classpath is not available in applet environment. You need to pack together the applet code and all its dependencies, and reference the libraries using the `archive` attribute of the applet descriptor. Could you check if previous applet had the older version 1.3 ? – pedrofb Dec 04 '16 at 14:28
  • @pedrofb - I don't see the previous commons-codec-1.3.jar anywhere in the applet zip package that I install on the web server. – Seymour Butts Dec 05 '16 at 01:42
  • Please Take a look to these questions http://stackoverflow.com/questions/6669617/adding-a-third-party-library-to-java-applet and http://stackoverflow.com/questions/2829388/how-do-i-package-up-an-applet-with-multiple-jar-libraries if you are using JNLP, you also need to configure the .jnlp deployment file. It would be helpful if you post your applet configuration files – pedrofb Dec 05 '16 at 07:50

1 Answers1

0

did you include apache commons project lib,like

org.apache.commons:commons-compress
org.apache.commons:commons-email
org.apache.commons:commons-io
org.apache.commons:commons-lang3
org.apache.commons:commons-parent
org.apache.commons:commons-pool2

the commons-codec 's GAV is

commons-codec:commons-codec 

but it's package name is

org.apache.commons.codec

this package name will be conflict with apache commons lib package name, try to change the package name of commons-codec & generate it as a jar or import the source code to your project.