{"id":3195,"date":"2014-03-20T01:26:35","date_gmt":"2014-03-20T01:26:35","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/20\/java-lang-nosuchmethoderror-org-apache-commons-codec-binary-base64-encodebase64string-in-java-ee-application-collection-of-common-programming-errors\/"},"modified":"2014-03-20T01:26:35","modified_gmt":"2014-03-20T01:26:35","slug":"java-lang-nosuchmethoderror-org-apache-commons-codec-binary-base64-encodebase64string-in-java-ee-application-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/20\/java-lang-nosuchmethoderror-org-apache-commons-codec-binary-base64-encodebase64string-in-java-ee-application-collection-of-common-programming-errors\/","title":{"rendered":"java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String() in Java EE application-Collection of common programming errors"},"content":{"rendered":"<p>That method was introduced in Commons Codec 1.4. This exception indicates that you&#8217;ve an older version of Commons Codec somewhere else in the webapp&#8217;s runtime classpath which got precedence in classloading. Check all paths covered by the webapp&#8217;s runtime classpath. This includes among others the <code>Webapp\/WEB-INF\/lib<\/code>, <code>YourAppServer\/lib<\/code>, <code>JRE\/lib<\/code> and <code>JRE\/lib\/ext<\/code>. Finally remove or upgrade the offending older version.<\/p>\n<p><strong>Update<\/strong>: as per the comments, you can&#8217;t seem to locate it. I can only suggest to outcomment the code using that newer method and then put the following line in place:<\/p>\n<pre><code>System.out.println(Base64.class.getProtectionDomain().getCodeSource().getLocation());\n<\/code><\/pre>\n<p>That should print the absolute path to the JAR file where it was been loaded from during runtime.<\/p>\n<p><strong>Update 2<\/strong>: this did seem to point to the right file. Sorry, I can&#8217;t explain your problem anymore right now. All I can suggest is to use a different <code>Base64<\/code> method like <code>encodeBase64(byte[])<\/code> and then just construct a <code>new String(bytes)<\/code> yourself. Or you could drop that library and use a different Base64 encoder, for example this one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>That method was introduced in Commons Codec 1.4. This exception indicates that you&#8217;ve an older version of Commons Codec somewhere else in the webapp&#8217;s runtime classpath which got precedence in classloading. Check all paths covered by the webapp&#8217;s runtime classpath. This includes among others the Webapp\/WEB-INF\/lib, YourAppServer\/lib, JRE\/lib and JRE\/lib\/ext. Finally remove or upgrade the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3195","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3195"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3195\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}