commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julius Davies <juliusdav...@gmail.com>
Subject Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;
Date Tue, 10 Nov 2009 19:12:09 GMT
Hi,

Can you supply some version information?

Local machine
-----------------------------
OS Type and Version?
Java Version?
Websphere version?
Commons-Codec version?


Dev machine
-----------------------------
OS Type and Version?   Linux.
Java Version?
Websphere version?
Commons-Codec version?


Also, can you find out if any different versions of commons-codec are
also present on the dev machine?  Perhaps several versions of the jar
file are sitting around, and Websphere is picking up an old one?



yours,

Julius





On Tue, Nov 10, 2009 at 10:13 AM, Java Struts <struts234@gmail.com> wrote:
> Hi Folks,
>
> I am using Apache Commons Codec, to convert the encrypted bytes into a
> HexString to pass through the URL. So when i am using it in local machine
> which is working fine. when the same into Dev(Linux websphere) it's not
> working and it's throwing the following exception.
>
> *java.lang.NoSuchMethodError:
> org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;*
>
> Here is the code i am using for it.
>
> *public static String encryptString(SecretKey key, String input) throws
> NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
>        logger.error(" Input String to Encrypt: " + input );
>        Cipher cipher = Cipher.getInstance("DESede");
>        cipher.init(Cipher.ENCRYPT_MODE, key);
>        //byte[] inputBytes = input.getBytes();
>        String encryptedString ="";
>        byte[] inputBytes;
>
>        try {
>            logger.error(" Inside Try block of Encrypted String Method");
>            inputBytes = input.getBytes("UTF-8");
>            byte[] encryptedBytes= cipher.doFinal(inputBytes);
>            logger.error(" got encrypted bytes");
>
>            encryptedString= Hex.encodeHexString(encryptedBytes);
>            logger.error(" Encrypted String : " +encryptedString);
>            }
>        catch (UnsupportedEncodingException e) {
>    // TODO Auto-generated catch block
>            logger.error("Inside Unsupported Catch Block " + e.getMessage()
> + " : "+  e );
>            e.printStackTrace();
>
>
>        }
>        catch (Throwable e) {
>            // TODO Auto-generated catch block
>            logger.error("Inside Exception Catch Block " + e.getMessage() +
> " : " +e );
>            e.printStackTrace();
>                }
>        return encryptedString;*
>
>
> Could you please help me guys, I am just wondering why this is throwing in
> Dev. It's throwing the exceptions at the below line.
>
>  *encryptedString= Hex.encodeHexString(encryptedBytes);
> *
> and catching at here
>
> *catch (Throwable e) {
>            // TODO Auto-generated catch block
>            logger.error("Inside Exception Catch Block " + e.getMessage() +
> " : " +e );
>            e.printStackTrace();
>                }
>
> *any idea what's going on here?* *I would appreciate for your help.*
>
> *Thanks,*
>
>
> *
>



-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/logging.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message