You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Java Struts <st...@gmail.com> on 2009/11/10 19:13:42 UTC

java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

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,*


*

Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

Posted by James Carman <ja...@carmanconsulting.com>.
It's probably the space in "Program Files" ?  Either way, it's showing
that it's getting the file from the 1.4 jar, so that's a good sign
that you're using the one you think you're using.  I haven't use WS in
a long time, so I don't know what's going on with their classpath.
I'd make sure you turn on the setting that tells it to use the
application (not the container) classpath first.

On Mon, Nov 16, 2009 at 3:06 PM, Java Struts <st...@gmail.com> wrote:
> Hey thanks a lot for the response...
>
> I have added the below code to the my code and i am getting the below
> exception. It is able to find the jar file location but i am getting the
> exception for the below line.
> JarFile jarFile = new JarFile(new File(loc.toURI()));
>
> The exception is here..
>
> Illegal character in path at index 16: file:/C:/Program
> Files/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/installedApps/VIPFOLSL0039Node01Cell/TeleworkServiceEAR.ear/lib/commons-codec-1.4.jar
> : java.net.URISyntaxException: Illegal character in path at index 16:
>
> don't know wht's going on.. Here is the manifest file for the same.
>
> Manifest-Version: 1.0
> Class-Path: TeleworkServiceJAVA.jar
>  lib/commons-codec-1.4.jar
>  lib/classes12.jar
>  lib/commons-logging.jar
>  lib/j2ee.jar
>  lib/log4j-1.2.15.jar
>  lib/commons-lang-2.4.jar
>
> One more thing is.. i have added the same code to a simple standalone java
> class file and which is working fine. But why it's giving the problem at the
> webspehere level i don't know...
>
>
> Could you please help me on this.
>
> Thanks,
> Srini.
>
>
> On Tue, Nov 10, 2009 at 4:25 PM, James Carman <ja...@carmanconsulting.com>wrote:
>
>> It's obviously a classpath issue.  Throw this code somewhere where it
>> can be executed in your environment where you're having troubles:
>>
>> final URL loc =
>> Hex.class.getProtectionDomain().getCodeSource().getLocation();
>> System.out.println("Found jar file at " + loc);
>> final JarFile jarFile = new JarFile(new File(loc.toURI()));
>> System.out.println("The version is " +
>>
>> jarFile.getManifest().getMainAttributes().getValue("Specification-Version"));
>>
>> On Tue, Nov 10, 2009 at 2:59 PM, Java Struts <st...@gmail.com> wrote:
>> > Hi Julis,
>> >
>> > Thanks a lot for the response. Here is the info. I am thinking it might
>> be
>> > the classpath issue. But i am not 100% sure.
>> >
>> > Thanks,
>> >
>> >
>> > On Tue, Nov 10, 2009 at 2:12 PM, Julius Davies <juliusdavies@gmail.com
>> >wrote:
>> >
>> >> Hi,
>> >>
>> >> Can you supply some version information?
>> >>
>> >> Local machine
>> >> -----------------------------
>> >> OS Type and Version? *Windows Xp Pro*
>> >> Java Version? *1.5*
>> >> Websphere version? *6.0*
>> >> Commons-Codec version? *1.4*
>> >>
>> >>
>> >> Dev machine
>> >> -----------------------------
>> >> OS Type and Version?   Linux. *HP-UX,  B.11.11 *
>> >> Java Version? :1.5
>> >> Websphere version? 6.0
>> >> Commons-Codec version? 1.4
>> >>
>> >>
>> >> 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 <st...@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
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>

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


Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

Posted by Jörg Schaible <jo...@gmx.de>.
Java Struts wrote at Montag, 16. November 2009 22:41:

> Could you please tell me the format of the manifest file?
> 
> do i have to add every thing in the same line with space as delimiter?

http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html

Delimiter is space, line may not exceed 72 characters (well, bytes) and must
be continued then. Have a look at the manifest Maven or Ant is creating.

- Jörg


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


Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

Posted by Java Struts <st...@gmail.com>.
Could you please tell me the format of the manifest file?

do i have to add every thing in the same line with space as delimiter?

Thanks,

On Mon, Nov 16, 2009 at 4:19 PM, Jörg Schaible <jo...@gmx.de>wrote:

> Java Struts wrote:
>
> > Hey thanks a lot for the response...
> >
> > I have added the below code to the my code and i am getting the below
> > exception. It is able to find the jar file location but i am getting the
> > exception for the below line.
> > JarFile jarFile = new JarFile(new File(loc.toURI()));
> >
> > The exception is here..
> >
> > Illegal character in path at index 16: file:/C:/Program
> >
>
> Files/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/installedApps/VIPFOLSL0039Node01Cell/TeleworkServiceEAR.ear/lib/commons-codec-1.4.jar
> > : java.net.URISyntaxException: Illegal character in path at index 16:
> >
> > don't know wht's going on.. Here is the manifest file for the same.
> >
> > Manifest-Version: 1.0
> > Class-Path: TeleworkServiceJAVA.jar
> >  lib/commons-codec-1.4.jar
> >  lib/classes12.jar
> >  lib/commons-logging.jar
> >  lib/j2ee.jar
> >  lib/log4j-1.2.15.jar
> >  lib/commons-lang-2.4.jar
> >
> > One more thing is.. i have added the same code to a simple standalone
> java
> > class file and which is working fine. But why it's giving the problem at
> > the webspehere level i don't know...
>
> The format of the manifest file is simply wrong, it fails after
> the "Class-Path:" line and will not find the other libraries.
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

Posted by Jörg Schaible <jo...@gmx.de>.
Java Struts wrote:

> Hey thanks a lot for the response...
> 
> I have added the below code to the my code and i am getting the below
> exception. It is able to find the jar file location but i am getting the
> exception for the below line.
> JarFile jarFile = new JarFile(new File(loc.toURI()));
> 
> The exception is here..
> 
> Illegal character in path at index 16: file:/C:/Program
>
Files/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/installedApps/VIPFOLSL0039Node01Cell/TeleworkServiceEAR.ear/lib/commons-codec-1.4.jar
> : java.net.URISyntaxException: Illegal character in path at index 16:
> 
> don't know wht's going on.. Here is the manifest file for the same.
> 
> Manifest-Version: 1.0
> Class-Path: TeleworkServiceJAVA.jar
>  lib/commons-codec-1.4.jar
>  lib/classes12.jar
>  lib/commons-logging.jar
>  lib/j2ee.jar
>  lib/log4j-1.2.15.jar
>  lib/commons-lang-2.4.jar
> 
> One more thing is.. i have added the same code to a simple standalone java
> class file and which is working fine. But why it's giving the problem at
> the webspehere level i don't know...

The format of the manifest file is simply wrong, it fails after
the "Class-Path:" line and will not find the other libraries.

- Jörg


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


Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

Posted by Java Struts <st...@gmail.com>.
Hey thanks a lot for the response...

I have added the below code to the my code and i am getting the below
exception. It is able to find the jar file location but i am getting the
exception for the below line.
JarFile jarFile = new JarFile(new File(loc.toURI()));

The exception is here..

Illegal character in path at index 16: file:/C:/Program
Files/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/installedApps/VIPFOLSL0039Node01Cell/TeleworkServiceEAR.ear/lib/commons-codec-1.4.jar
: java.net.URISyntaxException: Illegal character in path at index 16:

don't know wht's going on.. Here is the manifest file for the same.

Manifest-Version: 1.0
Class-Path: TeleworkServiceJAVA.jar
 lib/commons-codec-1.4.jar
 lib/classes12.jar
 lib/commons-logging.jar
 lib/j2ee.jar
 lib/log4j-1.2.15.jar
 lib/commons-lang-2.4.jar

One more thing is.. i have added the same code to a simple standalone java
class file and which is working fine. But why it's giving the problem at the
webspehere level i don't know...


Could you please help me on this.

Thanks,
Srini.


On Tue, Nov 10, 2009 at 4:25 PM, James Carman <ja...@carmanconsulting.com>wrote:

> It's obviously a classpath issue.  Throw this code somewhere where it
> can be executed in your environment where you're having troubles:
>
> final URL loc =
> Hex.class.getProtectionDomain().getCodeSource().getLocation();
> System.out.println("Found jar file at " + loc);
> final JarFile jarFile = new JarFile(new File(loc.toURI()));
> System.out.println("The version is " +
>
> jarFile.getManifest().getMainAttributes().getValue("Specification-Version"));
>
> On Tue, Nov 10, 2009 at 2:59 PM, Java Struts <st...@gmail.com> wrote:
> > Hi Julis,
> >
> > Thanks a lot for the response. Here is the info. I am thinking it might
> be
> > the classpath issue. But i am not 100% sure.
> >
> > Thanks,
> >
> >
> > On Tue, Nov 10, 2009 at 2:12 PM, Julius Davies <juliusdavies@gmail.com
> >wrote:
> >
> >> Hi,
> >>
> >> Can you supply some version information?
> >>
> >> Local machine
> >> -----------------------------
> >> OS Type and Version? *Windows Xp Pro*
> >> Java Version? *1.5*
> >> Websphere version? *6.0*
> >> Commons-Codec version? *1.4*
> >>
> >>
> >> Dev machine
> >> -----------------------------
> >> OS Type and Version?   Linux. *HP-UX,  B.11.11 *
> >> Java Version? :1.5
> >> Websphere version? 6.0
> >> Commons-Codec version? 1.4
> >>
> >>
> >> 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 <st...@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
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

Posted by James Carman <ja...@carmanconsulting.com>.
It's obviously a classpath issue.  Throw this code somewhere where it
can be executed in your environment where you're having troubles:

final URL loc = Hex.class.getProtectionDomain().getCodeSource().getLocation();
System.out.println("Found jar file at " + loc);
final JarFile jarFile = new JarFile(new File(loc.toURI()));
System.out.println("The version is " +
jarFile.getManifest().getMainAttributes().getValue("Specification-Version"));

On Tue, Nov 10, 2009 at 2:59 PM, Java Struts <st...@gmail.com> wrote:
> Hi Julis,
>
> Thanks a lot for the response. Here is the info. I am thinking it might be
> the classpath issue. But i am not 100% sure.
>
> Thanks,
>
>
> On Tue, Nov 10, 2009 at 2:12 PM, Julius Davies <ju...@gmail.com>wrote:
>
>> Hi,
>>
>> Can you supply some version information?
>>
>> Local machine
>> -----------------------------
>> OS Type and Version? *Windows Xp Pro*
>> Java Version? *1.5*
>> Websphere version? *6.0*
>> Commons-Codec version? *1.4*
>>
>>
>> Dev machine
>> -----------------------------
>> OS Type and Version?   Linux. *HP-UX,  B.11.11 *
>> Java Version? :1.5
>> Websphere version? 6.0
>> Commons-Codec version? 1.4
>>
>>
>> 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 <st...@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
>>
>>
>

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


Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

Posted by Java Struts <st...@gmail.com>.
Hi Julis,

Thanks a lot for the response. Here is the info. I am thinking it might be
the classpath issue. But i am not 100% sure.

Thanks,


On Tue, Nov 10, 2009 at 2:12 PM, Julius Davies <ju...@gmail.com>wrote:

> Hi,
>
> Can you supply some version information?
>
> Local machine
> -----------------------------
> OS Type and Version? *Windows Xp Pro*
> Java Version? *1.5*
> Websphere version? *6.0*
> Commons-Codec version? *1.4*
>
>
> Dev machine
> -----------------------------
> OS Type and Version?   Linux. *HP-UX,  B.11.11 *
> Java Version? :1.5
> Websphere version? 6.0
> Commons-Codec version? 1.4
>
>
> 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 <st...@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
>
>

Re: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString([B)Ljava/lang/String;

Posted by Julius Davies <ju...@gmail.com>.
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 <st...@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