WM AES-256 encryption

i have a WM java service that calls a java class from a JAR file which encrypts a string using AES-256.
The encryption/decryption work fine in the same WM java service but when i try to decrypt the string in an another java application i get this error:

Exception in thread “main” javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA12275)
at javax.crypto.Cipher.doFinal(DashoA12275)
at com.ibx.kraft.sso.crypto.CryptoAES.decryptString(CryptoAES.java:132)
at com.ibx.kraft.sso.bridge.action.Test.main(Test.java:30)

i compared the encrypted strings both in WM and with the one generated for the same input in the java application and they are different.

I have installed the unlimited strength policy files both for WM and the java application.

The java app is compiled with JDK1.5.0_15.
WM uses JDK1.5.0_15