commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Java Struts <struts...@gmail.com>
Subject Re: java.lang.NoClassDefFoundError: org.apache.commons.codec.binary.Hex
Date Tue, 13 Oct 2009 17:02:26 GMT
Hi,

Thanks a lor for your reply. When i do the deployment, it's not giving any
error. Is there any other thing that i can do?

Thanks,


On Tue, Oct 13, 2009 at 12:58 PM, adasal <adam.saltiel@gmail.com> wrote:

>  java.lang.NoClassDefFoundError: org.apache.commons.codec.binary.Hex
>
> Check the classpath of your run time environment.
> This is a deploy issue.
>
> Adam
>
>
> 2009/10/13 Java Struts <struts234@gmail.com>
>
> > I am trying to use the Hex encoding. So when ran it as a java application
> > which is working fine. And whn i incorporated the same in my code and
> > deployed the ear.. i am getting this exception.
> > And i have included the jar file in the ear. I didn't understand wht's
> > happeining.. any help?
> >
> > 4 gov.ed.telework.delegate.TeleworkDelegate - got RemoteException
> > RemoteException occurred in server thread; nested exception is:
> >        java.rmi.RemoteException: ; nested exception is:
> >        java.lang.NoClassDefFoundError:
> org.apache.commons.codec.binary.Hex
> > 10/09 12:12:49 execute 100 WebContainer : 4
> > gov.ed.telework.ui.EmpTeleworkAgreementAction - Unexpected Expection:
> > Exception occurred..
> >
> > Here is the code for it..
> >
> > *public* *static* String encryptString(SecretKey key, String input)
> > *throws* NoSuchAlgorithmException, NoSuchPaddingException,
> > InvalidKeyException, IllegalStateException, IllegalBlockSizeException,
> > BadPaddingException, UnsupportedEncodingException {
> >        Cipher cipher = Cipher.getInstance("DESede");
> >        cipher.init(Cipher.ENCRYPT_MODE, key);
> >        //byte[] inputBytes = input.getBytes();
> >        *byte*[] inputBytes = input.getBytes("UTF-8");
> >        *byte*[] encryptedBytes= cipher.doFinal(inputBytes);
> >        //String encryptedString = new
> > sun.misc.BASE64Encoder().encode(encryptedBytes);
> >
> >        String abc =
> > org.apache.commons.codec.binary.Hex.encodeHexString(encryptedBytes);
> >        *return* abc;
> >        //return URLEncoder.encode(encryptedString, "UTF-8");
> >        //return encryptedString;
> >        }
> >  *public* *static* String decryptString(SecretKey key, String
> > encryptedString) *throws* IOException, NoSuchAlgorithmException,
> > NoSuchPaddingException, InvalidKeyException,
> > IllegalBlockSizeException, BadPaddingException, DecoderException {
> >                // TODO Auto-generated method stub
> >
> >        *byte*  abc[] =
> >
> >
> org.apache.commons.codec.binary.Hex.decodeHex(encryptedString.toCharArray());
> >
> >        //String ka = URLDecoder.decode(encryptedString, "UTF-8");
> >        //byte[] encryptedBytes = new
> > sun.misc.BASE64Decoder().decodeBuffer(ka);
> >        Cipher cipher = Cipher.getInstance("DESede");
> >        cipher.init(Cipher.DECRYPT_MODE, key);
> >        //byte[] recoveredBytes = cipher.doFinal(encryptedBytes);
> >        *byte*[] recoveredBytes = cipher.doFinal(abc);
> >        //String recoveredString = new String(recoveredBytes);
> >        String recoveredString = *new* String(recoveredBytes,"UTF-8");
> >        *return* recoveredString;
> >        }
> >
> > Could you guys please help me on this?
> >
> > Thanks,
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message