Weblogic Deployment Exception : PaddingException: Could not perform unpadding: invalid pad byte
Asked Answered
K

3

12

This question is asked (and answered) just to share some knowledge with the SO Community.

I have recently came up with a deployment Exception of my web application (after receiving some changes from the SVN Repository) that said:

< Error > < Deployer > with ID '1350377960779' for task '1'. Error is: 'com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding: invalid pad byte.' com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding: invalid pad byte. at com.rsa.jsafe.c.a(Unknown Source) at com.rsa.jsafe.JSAFE_SymmetricCipher.decryptFinal(Unknown Source) at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptBytes(JSafeEncryptionServiceImpl.java:124) at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptString(JSafeEncryptionServiceImpl.java:184) at weblogic.security.internal.encryption.ClearOrEncryptedService.decrypt(ClearOrEncryptedService.java:96) Truncated. see log file for complete stacktrace Caused By: com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding: invalid pad byte.

Knuckleduster answered 16/10, 2012 at 9:43 Comment(0)
K
15

Googling to find an answer was not very helpful. After examining the files received from my SVN repository, i noticed that a jdbc application resource was changed.

Examining the jdbc resource more closely i found that it was using the password-encrypted property which is used only for production environments

<password-encrypted>{AES}some+very+long+encrypted+string</password-encrypted>

So I commented out this property and used the property used for the development environment:

 <properties>
     <property>
        <name>user</name>
        <value>MY_USER</value>
     </property>
     <property>
        <name>password</name>
        <value>MY_PASS_IN_PLAIN_TEXT</value>
     </property>
  </properties>

And that worked just fine.

Knuckleduster answered 16/10, 2012 at 9:43 Comment(0)
R
6

I just had this problem, and all I had to do was save the page on the Connection Pool page while the password was blank. Of course then it would fail. Then put in the password and save again. This time no Pad byte error and it conencts without fail.

Redaredact answered 29/9, 2014 at 18:6 Comment(4)
Tried this approach in WebLogic 12.1.3 and while it is possible to 'save' the change, it is unable to 'Activate Changes' still giving the 'PaddingException'.Borreri
@Borreri You might need to remove the Target temporarily, so you'll be able to save your config changes.Wanting
I can't believe that worked! Thanks for saving me from a weird headache.Regelation
@Wanting your comment helped me a lot. Cheers!Stoecker
R
1

I clicked MaVRoSCy own response as usefull, because it works. But the downside it's that your password became visible (might not be a problem at development env).

This problem with password encryption can be overcome by reencrypting your password at your weblogic instance.

To do so, go to your weblogic domain, ex: ORACLE_HOME\user_projects\domains\YOUR_DOMAIN

And execute this command: java weblogic.security.Encrypt YOUR_PASSWORD

This will output something like: {AES}0gcupcB95gtlr6VYnT3TZK5PxiATDuIUe3kRKd3b/Ag=

This is your encrypted password for your weblogic instance.

Then just replace it at your password-encrypted property inside datasource xml configuration.

<password-encrypted>{AES}0gcupcB95gtlr6VYnT3TZK5PxiATDuIUe3kRKd3b/Ag=</password-encrypted>
Recalescence answered 4/8, 2017 at 18:29 Comment(1)
Notice. You might get "Error: Could not find or load main class weblogic.security.Encrypt". In that case, go to the bin folder and enter this: . ./setDomainEnv.sh Notice the dot before script name. When you press enter you will be back in your domain home. Now enter "java weblogic.security.Encrypt" and it will workAmontillado

© 2022 - 2024 — McMap. All rights reserved.