2 Replies Latest reply on Jul 14, 2011 9:06 AM by kanwalu

    JBOSS AS6 :

    kanwalu

      I am debugging my web application (with one servlet and many java classes) using Eclipse for J2EE, JBOSS AS 6 and JRE6.

       

      When I run the server, I get 'Class CastException com.sun.crypto.provider.AESCipher cannot be cast to javax.crypto.CipherSpi' on the following piece of code:

       

      •      cipherObj = Cipher.getInstance("AES/ECB/PKCS5Padding");

       

      This exception does not occur if I use Tomcat server.

       

      I have also tried to use a simple java console application and included the required class file (javax.crypto.Cipher) to test my piece of code and it runs fine there. Hence, the error is related to JBoss server.

       

      Please help me with this error.

        • 1. Re: JBOSS AS6 :
          wolfgangknauf

          Hi,

           

          I assume "com.sun.crypto.provider.AESCipher" and "javax.crypto.CipherSpi" are both bundled in the JDK/JRE. Does your app bundle any JAR file which contains one of those two classes? The error message sounds like a classloading conflict.

           

          Best regards

           

          Wolfgang

          1 of 1 people found this helpful
          • 2. Re: JBOSS AS6 :
            kanwalu

            Yes, you are right. This was precisely the error. I had bcprov-jdk13-132.jar in my lib folder that contains a conflicting class version of javax.crypto.Cipher that JRE already has in jce.jar.

             

             

            Why couldnt JBoss 6 resolve conflicting jars issue like others servers do?