java.lang.IllegalStateException: Cipher not initialized during loadtest
811899Nov 9 2010 — edited Nov 9 2010Hi All,
Below is my code :
static Cipher pbeCipher;
.........
byte[] encbytes = hexToByte( encrypted );
pbeCipher.init( javax.crypto.Cipher.DECRYPT_MODE, pbeKey, pbeParamSpec );
byte[] decbytes ;
synchronized (pbeCipher) {
decbytes = pbeCipher.doFinal( encbytes );
}
return new String( decbytes );
I got the below exception when we are actually performing the load tests where in 4000 hits are made on the code in 1 min.
java.lang.IllegalStateException: Cipher not initialized
at javax.crypto.Cipher.c(Unknown Source)
at javax.crypto.Cipher.doFinal(Unknown Source)
My doubt here is : Is it occuring becuase of synchronizing issue? As shown in the code above i had synchronized the doFinal call. Still the exceptions are occuring. These are randomly coming say 1 out of 500 hits.
Please suggest me a solution on how to fix this. We are using PBEWithMD5AndDES encryption mechanism in this case.
Solution for this would help me a lot in terms of fixing it...
Thanks in Advance......