Error: Could not find or load main class com.atlassian.secrets.cli.* - Jira
Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When attempting to encrypt the password as per articles below, you may run into this problem.
Advanced encryption for database conneciton ( dbconfig.xml )
Encrypt passwords in server.xml for Tomcat parameters ( server.xml )
"Error: Could not find or load main class com.atlassian.secrets.cli.tomcat.TomcatEncryptionTool" error.
Environment
Jira Data Center / Server
Diagnosis
As per Advanced encryption is required to run the command below to encrypt the password:
java -cp "./*" com.atlassian.secrets.cli.db.DbCipherTool -c com.atlassian.secrets.store.algorithm.AlgorithmSecretStore
However the error below is thrown, as it seems Java could not find or load the main class com.atlassian.secrets.cli.db.DbCipherTool
Error: Could not find or load main class com.atlassian.secrets.cli.db.DbCipherTool
Caused by: java.lang.ClassNotFoundException: com.atlassian.secrets.cli.db.DbCipherTool
As per Encrypt passwords in server.xmlis required to run the command below to encrypt the password:
java -cp "./*" com.atlassian.secrets.cli.tomcat.TomcatEncryptionTool
However the error below is thrown, as it seems Java could not find or load the main class com.atlassian.secrets.cli.tomcat.TomcatEncryptionTool
Error: Could not find or load main class com.atlassian.secrets.cli.tomcat.TomcatEncryptionTool
Caused by: java.lang.ClassNotFoundException: com.atlassian.secrets.cli.tomcat.TomcatEncryptionTool
The JAR files required for the encryption tool to work should be both, or either one of these below, depending of your Jira version:
atlassian-secrets-cli-x.x.x.jar
password-cipher-cli-x.x.x.jar
It has been identified that for some Jira x Java versions, both of these files are required for the encryption to work, however for some other versions, one of them should be sufficient for the encryption program to work.
It has also been identified that for some Jira versions, the file atlassian-secrets-cli-x.x.x.jar is not present on JIRA_INSTALL/bin that comes bundled with Jira install package, and that might be the culprit of the problem.
This might be related with the Java version used by Jira as well, however it needs more testing to confirm which Jira x Java versions are hitting to this problem.
Cause
A specific Jira version has not bundled the JAR file atlassian-secrets-cli-x.x.x.jar inside JIRA_INSTALL/bin, and that Jira x Java version requires both files for the encryption to work.
The JAR file atlassian-secrets-cli-x.x.x.jar has been somehow removed from JIRA_INSTALL/bin
The JAR file atlassian-secrets-cli-x.x.x.jar has been somehow changed its permission at JIRA_INSTALL/bin
Solution
If you have been affected by this problem, you should be able to workaround it by placing a atlassian-secrets-cli-x.x.x.jar file inside JIRA_INSTALL/bin:
Copy an atlassian-secrets-cli-x.x.x.jar from another installation or the backup. If you can't find the file in any of these, please contact Atlassian Support
Move the file to JIRA_INSTALL/bin
Perform the encryption steps as outlined in Advanced encryption and/or Encrypt passwords in server.xml
Restart Jira to take effect
If it's a Cluster, make sure to perform all the steps on each Node.
Was this helpful?