commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommy Pham <tommy...@yahoo.com>
Subject Re: java.lang.NoClassDefFoundError: org.apache.commons.codec.binary.Hex
Date Tue, 13 Oct 2009 21:03:46 GMT
----- Original Message ----
> From: Java Struts <struts234@gmail.com>
> To: Commons Users List <user@commons.apache.org>
> Sent: Tue, October 13, 2009 10:02:26 AM
> Subject: Re: java.lang.NoClassDefFoundError: org.apache.commons.codec.binary.Hex
> 
> 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,
> 

I'd check to make sure the jar file(s) are in the classpath after you deployed the app.  Might
be a bug somewhere during building of the project(s).

Regards,
Tommy

> 
> On Tue, Oct 13, 2009 at 12:58 PM, adasal 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 
> >
> > > 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,
> > >
> >


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


Mime
View raw message