Migration towards DHIS2.41 - Java/Tomcat Version compatibility

Hello Everyone,

We are trying to migrate our dhis2 from 2.37 to 2.41, but we are facing the following issue :

Mar 19 16:48:58 dev tomcat9[703]: 2025-03-19 16:48:58.699 ERROR o.g.a.w.WeavingClassFileTransformer - error weaving org/hisp/dhis/webapi/security/session/SpringHttpSessionInitializer: Unsupported class file major version 61

It looks like that this error is related to the java version. We have upgraded the java version of the lxc container to Java 17 (I think that is the required version for dhis2.41), but we still have the same issue.

Below the java version and tomcat config

Regards;
didate

Hi @didate

What’s the setenv.sh Java_Home configured to? It needs to be pointing to the JAVA 17 you’ve installed…

Hello @Gassim

Thank you for your response.

Do you know where this file is located ? We are using dhis2 ng-tools with lxc. I haven’t been able to find it.

Regards.

Hello @Gassim

I would like to up this topic, I’m still stuck.

@bobj could you please help ?

Regards;

1 Like

Hi @didate

I’m sorry to hear you’re still stuck. In the case that you are using ng-tools, I think it’s set up to find the Java version on its own (https://github.com/bobjolliffe/dhis2-tools-ng/commit/2f3d69eb60620d1bba8672bf89e0e73e75598aaa#diff-42073c94f645b39b5bbe4d37f6b009034f472b0e1d79c4090586681acb7f6935)

Could you check echo $JAVA_HOME to see that the path points to Java 17 and not a previous version?

Thanks!

Hello @didate,

Here are the steps:

  1. Login into the tomcat container.
  2. Find location /etc/default/tomcat9. Under this location you can find JAVA_OPT and change it as per your version.
  3. After changes you need to restart the containers.

Please confirm if issue is still there.

Thanks

2 Likes

Hello @Gassim and @MohinderS

Thank you for your help. I have added the two following lines at the end of the file etc/default/tomcat9 and it finally works.

export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/
JAVA_OPTS="-Djava.home=$JAVA_HOME"

Thank you all.

3 Likes

Hi @didate!
Thank you very much for these very clear tips.

2 Likes