Start a new topic

Upgrade xDM on AWS Marketplace AMI

Hi Semarchy xDM Community,


I struggled a lot to upgrade the version of xDM that I launched from a Semarchy-support AMI of xDM from AWS Marketplace. I had xDM version 2023.1.0 and I wanted to upgrade to 2024.3.0. 


The problem was that 2024.3.0 required Java 17 or 21 whereas the AWS Marketplace AMI contained Java 11. The old version of Java was blocking me. 

 

The documentation recommends adding a setenv.sh file in /etc/tomcat9/bin and a configuration file in /etc/tomcat9/conf. Neither helped. 


Here is a solution that solved my upgrade challenge: 


Update Java 

 

sudo apt update
sudo apt install openjdk-17-jdk

 

Set the version of Java

sudo update-alternatives --config java 
sudo update-alternatives --config javac 

 

Test version of Java in use

 

java -version

 

Edit the tomcat9 service configuration file

 

 sudo vim /lib/systemd/system/tomcat9.service 

Add the following environment variables under the [Service] section

 

Environment=JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
Environment=JRE_HOME=/usr/lib/jvm/java-17-openjdk-amd64 

On the ExecStart line, add the path to Java 17 to explicitly require Tomcat to use Java 17

 

ExecStart=/usr/lib/jvm/java-17-openjdk-amd64/bin/java 

 So the edited line will look like this: 

 

ExecStart=/usr/lib/jvm/java-17-openjdk-amd64/bin/java -Djava.util.logging.config.file=/etc/tomcat9/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -classpath /usr/share/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat9 -Dcatalina.home=/usr/share/tomcat9 -Djava.io.tmpdir=/tmp/tomcat9-tomcat9-tmp org.apache.catalina.startup.Bootstrap start 

 

Restart Tomcat to use Java 17

 

sudo service tomcat9 stop
sudo service tomcat9 start 

Check tomcat manager is using Java 17

You can check by logging into Tomcat Manager http://[IP address]/manager/html 

You can also check by checking the semarchy.log which shows you the  version of Java that Tomcat is running. For example, find a line that looks like this:  

20-Dec-2023 18:04:13.251 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           21.0.1

 Working for me as of Oct 2024

Login to post a comment