Failed to upgrade to Java 11. Attempting to do so broke Team City.

I am have been getting the following message for several months:

This TeamCity server is using a deprecated version of Java (8). Please upgrade to Java 11 as future versions of TeamCity will be incompatible with Java 8.

To fix this, I attempted to upgrade to Java 11 manually following the instructions here:

https://www.jetbrains.com/help/teamcity/how-to.html#Install+Non-Bundled+Version+of+Java

and, more explicitly, here,

https://happydevops.com/2023/01/05/upgrade-the-jre-in-teamcity-windows/

On the build server I installed Java 11 in a separate directory `C:\Java11` and then set the TEAMCITY_JRE environment variable to point to where I had installed Java 11. Specifically, I set it to `C:\Java11\jre` which contains directories bin, conf, legal and lib.

I then restarted Team City and all hell broke loose! Team City refused to start and insisted I type in a password found in a log file. I copy/pasted this in but it said it was wrong (it was correct). I was only able to recover the situation by deleting the TEAMCITY_JRE environment variable and restarting the service.

Firstly, why is it necessary for us to manually upgrade Java? TC comes with a bundled version of Java so why can't new versions simply have the correct version of Java bundled. As you can see, asking users to manually copy files etc can be accident prone. I was lucky in that I put Java 11 in a separate directory but if I had copied the files over the built in Java (as recommended), my installation would have been permanently destroyed.

If I must install Java 11 manually, please give a precise link to which version of Java 11, there are many! Please tell me exactly which directory TEAMCITY_JRE should point to. I set it to the outer directory but perhaps it should have been to the bin directory?

0
5 comments

Sorry to hear you're having a tough time upgrading the Java for your TeamCity server. I'm not exactly sure about the issue you ran into, but I can help get you straightened out. Java is not included in the automatic upgrades due to a number of reasons, but one big reason is that Java is only bundled with the Windows Installation of TeamCity. However, there are a few options to choose from when upgrading Java on a Windows installation of TeamCity:

  1. Use the Windows Installer to manually upgrade your TeamCity server. You can download the installer for your version of TeamCity from here. Then follow the instructions in our documentation on Upgrading using the Windows Installer.
  2. Download the latest TeamCity Windows Installer and extract the contents using 7zip or a similar utility. Then, replace your <teamcity home directory>/jre directory with the jre directory that was extracted from the Windows Installer.
  3. Install a Java of your choosing to Windows and set the TEAMCITY_JRE environment variable to the installation path. 

The latest TeamCity Windows Installers come bundled with Amazon Corretto 11. This Java is completely free and would be fine for most cases, I would suggest using this if you decide to go with option #3. Download the Windows x64 version from here. Installation instructions for Amazon Corretto can be found on the Amazon Corretto page here: https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/windows-7-install.html. You don't need to set JAVA_HOME, as stated in their instructions. Instead, set TEAMCITY_JRE=C:\Program Files\Amazon Corretto\jdk11.0.18_10 (which is the latest version at the time of writing).

One more important note: Are you upgrading from a 32-bit Java? If so, be sure to adjust your JVM memory settings as mentioned in Update from 32-bit to 64-bit Java.

0

Thanks very much I will try option #3 as it seems the least risky! Thanks for the direct link to Amazon Corretto 11. I'm not sure if I'm upgrading from 32-bit Java, how can I find this out?

0

Probably the easiest way to check what version of Java your currently using would be to look in Administration | Diagnostics in the TeamCity Web UI. 

0

Sorry to take so long to reply on this. It seems we are indeed running a 32-bit version of Java:

Java version: 1.8.0_151
Java VM info: Java HotSpot(TM) Server VM (32 bit)
Java Home path: c:\TeamCity\jre
Server: Apache Tomcat/8.5.84
JVM arguments:
-Djava.util.logging.config.file=c:\TeamCity\bin\..\conf\logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Xmx1024m -Xrs -Dteamcity.configuration.path=../conf/teamcity-startup.properties -Dlog4j2.configurationFile=file:../conf/teamcity-server-log4j.xml -Dteamcity_logs=c:\TeamCity\bin\..\logs -Dignore.endorsed.dirs= -Dcatalina.base=c:\TeamCity\bin\.. -Dcatalina.home=c:\TeamCity\bin\.. -Djava.io.tmpdir=c:\TeamCity\bin\..\temp 

We can go through the procedure of upgrading to 64 bit but I think we will need to backup our server VM in case the upgrade fails.

0
Hello John,
Please let us know if the upgrade works well for you or if we can help you any further with this.

Thank you,

Guilherme
0

Please sign in to leave a comment.