I'm trying to implement a new security bean, which relies on some Base64 encoding. In eclipse, the class compiles just fine, and indeed, it builds when deployed to tomcat, running locally; however, when the code actually reaches the line in which it invokes
Base64.encodeBase64String(rawBytes)
I get this
SEVERE: Servlet.service() for servlet analytics threw exception
java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String([B)Ljava/lang/String;
I've taken care to import the type I want (org.apache.commons.codec.binary.Base64) and have tried changing the invocation to use the absolute package name of the method.
When I examine the pom.xml for the project, I see that the following exists, and it is the correct artifact, according to the apache site:
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
Looking in the dependency hierarchy view in eclipse, commons-codec jar is included at compile time at version 1.4 (which contains the class in question).
A similar question here suggested purging the tomcat work directory, so I did that to no avail. I'm not exactly an expert on maven or tomcat, so any suggestions will be helpful. I'm aware that this is a highly specific problem and so I'm posting this in hopes of a few clues, and to clarify the problem to myself. I'll accept any answer that points in the right direction, though!