My Oracle Support Banner

OAM server is failed to start up correctly and throwing the error 'Caused By: javax.crypto.BadPaddingException: Given final block not properly padded' (Doc ID 1590687.1)

Last updated on FEBRUARY 22, 2018

Applies to:

Oracle Access Manager - Version 11.1.1.5.5 and later
Information in this document applies to any platform.

Symptoms

We have encountered OAM server was failing to start up correctly and throwing the error 'Caused By: javax.crypto.BadPaddingException: Given final block not properly padded'. See below for full stack trace from OAM Diagnostics log:

<Oct 1, 2013 10:06:15 AM EST> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application 'oam_server'.
weblogic.application.ModuleException: [HTTP:101216]Servlet: "AMInitServlet" failed to preload on startup in Web application: "oam".
java.lang.ExceptionInInitializerError
        at oracle.security.am.engines.sso.adapter.AbstractSessionAdapterImpl.checkAndInit(AbstractSessionAdapterImpl.java:92)
        at oracle.security.am.engines.sso.adapter.AbstractSessionAdapterImpl.<init>(AbstractSessionAdapterImpl.java:75)
        at oracle.security.am.engines.sso.adapter.MultipleUserSessionAdapterImpl.<init>(MultipleUserSessionAdapterImpl.java:56)
        at oracle.security.am.engines.sso.adapter.MultipleUserSessionAdapterImpl.<clinit>(MultipleUserSessionAdapterImpl.java:45)
        at oracle.security.am.engines.sso.adapter.SessionManagementAdapterFactory.getAdapter(SessionManagementAdapterFactory.java:46)
        at oracle.security.am.engines.enginecontroller.SSOEngineController.processEvent(SSOEngineController.java:492)
        at oracle.security.am.controller.MasterController.processEvent(MasterController.java:568)
        at oracle.security.am.controller.MasterController.processRequest(MasterController.java:757)
        at oracle.security.am.controller.MasterController.process(MasterController.java:680)
        at oracle.security.am.pbl.transport.http.AMInitServlet.initializeAmServer(AMInitServlet.java:137)
        at oracle.security.am.pbl.transport.http.AMInitServlet.init(AMInitServlet.java:79)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
        at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
        at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1986)
        at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1960)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1879)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3161)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1511)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:483)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
        at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
        at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
        at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
        at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
        at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
        at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
        at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
        at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:531)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.security.am.common.utilities.exception.AmRuntimeException: OAM Server Key initialization failed.
        at oracle.security.am.engines.sso.adapter.OAMSessionConfiguration$ConfigListener.configurationChanged(OAMSessionConfiguration.java:148)
        at oracle.security.am.engines.sso.adapter.OAMSessionConfiguration.registerConfigChangeListener(OAMSessionConfiguration.java:73)
        at oracle.security.am.engines.sso.adapter.OAMSessionConfiguration.<init>(OAMSessionConfiguration.java:67)
        at oracle.security.am.engines.sso.adapter.OAMSessionConfiguration.<clinit>(OAMSessionConfiguration.java:57)
        ... 53 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
        at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
        at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
        at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA13*..)
        at javax.crypto.Cipher.doFinal(DashoA13*..)
        at oracle.security.am.common.utilities.crypto.AESEncrypter.decrypt(AESEncrypter.java:159)
        at oracle.security.am.common.utilities.crypto.OAMKeyStore.decryptKeyData(OAMKeyStore.java:273)
        at oracle.security.am.engines.sso.adapter.OAMSessionConfiguration$ConfigListener.configurationChanged(OAMSessionConfiguration.java:145)
        ... 56 more

        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1513)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:483)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        Truncated. see log file for complete stacktrace
Caused By: javax.crypto.BadPaddingException: Given final block not properly padded
        at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
        at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
        at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA13*..)
        at javax.crypto.Cipher.doFinal(DashoA13*..)
        at oracle.security.am.common.utilities.crypto.AESEncrypter.decrypt(AESEncrypter.java:159)
        Truncated. see log file for complete stacktrace

 
After following the instructions as mentioned in Doc ID: 1354918.1 - deleting the CSF keys and removing the .oamkeystore file, we were expecting the file to be regenerated on startup. However the AdminServer and oam_server1 managed server both complain that the file could not be found during startup, and the OAM server continues to fail to start.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.