After a failover switch in OpManager, the APM Plugin on the Standby server throws authtoken encryption errors and plugin functionalities such as monitoring, alerts, and data collection do not work.
When accessing the Applications tab in OpManager UI, the following error is displayed:
The following errors also appear in the APM Plugin logs on the Standby server:
<OPM_Home>\AppManager\logs\stderr.txtjava.lang.NullPointerException
at com.adventnet.appmanager.util.UserScopeUtil.getEARKeyForDBPoll(UserScopeUtil.java:513)
at com.adventnet.appmanager.util.UserScopeUtil.regenerateUserToken(UserScopeUtil.java:368)java.lang.Exception: keyToken/plainText is invalid.
at com.adventnet.appmanager.util.AMEncryption.encrypt_AES_CBC_withKey(AMEncryption.java:293)
<OPM_Home>\AppManager\logs\syncout.txt
PluginUtil.getPluginAuthTokenFromOpManagerDB() | EARKey is null |
Returning to avoid setting encrypted authtoken in cache
Both Primary and Standby APM Plugin servers share the same database, but each installation generates its own MasterEncryptionKey in <APM_Plugin_Home>\conf\DB_Crypt.properties.
During failover, the Standby cannot decrypt data that was encrypted by the Primary's key, resulting in the errors above.
MasterEncryptionKey mismatch between Primary and Standby APM Plugin servers.
Ensure both Primary and Standby APM Plugin servers use the same MasterEncryptionKey so encrypted data in the shared database can be decrypted by either server.
For a freshly installed APM Plugin on the Standby server, the steps depend on whether the Standby server has already been started at least once.
If the Standby APM Plugin has never been started, DB_Crypt.properties does not exist yet. Perform these steps before starting the Standby server or triggering failover:
DB_Crypt.properties file.DB_Crypt.properties does not exist — neither AMCryptKey nor MasterEncryptionKey have been generated. Copying the full file from Primary ensures both encryption keys are in sync from the start. No instance-specific data has been encrypted on Standby yet, so sharing the AMCryptKey does not cause any conflict.
If the Standby APM Plugin has been started at least once, DB_Crypt.properties already exists with its own unique AMCryptKey and MasterEncryptionKey. The AMCryptKey has already been used to encrypt instance-specific data (e.g., database passwords) on the Standby server. Only the MasterEncryptionKey needs to be synchronized:
MasterEncryptionKey.MasterEncryptionKey value with the one copied from Primary.DB_Crypt.properties file or modify the AMCryptKey. The AMCryptKey is instance-specific — it has already been used to encrypt the Standby's local database passwords. Replacing it will cause the Standby to fail decrypting its own DB connection credentials.
From build 179200, the MasterEncryptionKey is used for encrypting shared database data. Since each server already has its own different key, they must be synchronized. Copy the key from the server that was started first after the upgrade, as that server's key is used to encrypt data in the shared database:
<OPM_Home>\AppManager\logs\console1.txt<OPM_Home>\AppManager\logs\StartUpLogs_out.txtDB_Crypt.properties on both servers. This preserves the unique MasterEncryptionKey generated on each server during upgrade, and ensures the AMCryptKey can be restored in case the file is accidentally replaced instead of only updating the MasterEncryptionKey value.
MasterEncryptionKey.MasterEncryptionKey value with the one copied from Primary.MasterEncryptionKey.MasterEncryptionKey value with the one copied from Standby.MasterEncryptionKey must be copied from the server that was started first after upgrade, as that server's key is used to encrypt data in the shared database. Only replace the MasterEncryptionKey value — do not modify AMCryptKey or replace the entire file.
After applying the fix, trigger a failover and confirm:
NullPointerException or "EARKey is null" errors in the logs.