Symptom
Sonatype Nexus Repository running on a Windows operating system may suddenly become unlicensed causing features requiring a valid product license to stop working. This may be noticed when running Nexus Repository on a Windows operating system after a Oracle Java version between 8u63 to 8u152 is updated to any version up to 8u161. The Java update is performed using the Java Control Panel program -> Update tab -> Update Now button.
Affected Products
All licensed versions of Sonatype Nexus Repository
Oracle Java installed on a Windows operating system, that was installed using the official Oracle Java installer, Versions 8u63 to 8u151/152.
Cause
Oracle Java on Windows has an automatic update feature that uninstalls the previous Java version before installing the new version. During this process, the location inside the Windows registry where Java preferences are stored gets removed due to a Oracle Java bug JDK-8161945.
This comment from a Java engineer states:
Registry clean up occurred from 8u65 uninstaller. It actually doesn't matter if 8u65 is uninstalled after or before 9+130 is installed, it will clean the registry anyways. So the right AU scenario to verify the fix should be:
- install 9+130;
- create registry keys that should survive 9+130 uninstall;
- AU to 9+130 next ver.
This bug can be reproduced when Java is updated using the Java Control Panel Update Now button with these versions already installed
- 8u65 or newer upgraded to any java version up to and including 8u161
- 9.0 or newer upgraded to any java version up to and including 9.0.4
The bug should not occur if you are already running a Java version 8u161 or newer.
After Java is updated, Sonatype server products that are already running may still operate in a licensed state and not exhibit loss of license symptoms until they are restarted.
Avoiding The Bug
Option 1: Reinstall Product License
The affected Java versions should only be manually updated when you have a copy of the existing Sonatype product license file issued at the time of purchase and you have a scheduled maintenance window where Sonatype server products can be restarted.
After the Java update is complete, restart all Sonatype server products. Navigate to the product License page in a web browser and install the product license file using the server user interface.
Option 2: Export/Import Java Preferences
Before upgrading, make a backup of the Java preferences using the regedit.exe program.
A Sonatype server process is typically managed by Windows services and owned by the SYSTEM user account. In this case, the product license is found under the Windows registry path:
HKEY_USERS\.DEFAULT\Software\JavaSoft\Prefs\com\sonatype\
An alias to that path is:
HKEY_USERS\S-1-5-18\Software\JavaSoft\Prefs\com\sonatype\
What is the difference between HKEY_USERS\.DEFAULT\ and HKEY_USERS\S-1-5-18\ ?
If the Sonatype server process is being run by a regular user account, the license may be stored under:
HKEY_CURRENT_USER\Software\JavaSoft\Prefs\com\sonatype
Right-click on the JavaSoft Prefs registry node and choose Export and then save the .reg file.
After the Java update is complete, stop all Sonatype server products. Then using regedit, choose File -> Import... and import the saved JavaSoft.reg to re-import the Java preferences.
Start the Sonatype server product. Confirm the licensed features are functional and that the product license page displays the expected license information.
If there is a problem recovering your license, contact Sonatype support.