Java version issue?

Before you post: Your responses to these questions will help the community help you. Please complete this template if you’re asking a support question.
Don’t forget to select tags to help index your topic!

1. Describe your incident:
After upgrading Graylog-server to version 5.0.2 using yum, graylog service will not start, the /varlog/messages shows the following error message:

Exception in thread “main” java.lang.UnsupportedClassVersionError: org/graylog2/bootstrap/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

2. Describe your environment:

  • OS Information:
    RHEL 8.8
  • Package Version:
    5.0.2
  • Service logs, configurations, and environment variables:
    Error: A JNI error has occurred, please check your installation and try again
    Jun 13 17:22:04 graylogdev1 graylog-server[8611]: Exception in thread “main” java.lang.UnsupportedClassVersionError: org/graylog2/bootstrap/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

3. What steps have you already taken to try and solve the problem?
Tried upgrading the java packages, but this did not fix the issue. I tried upgrading to **OpenJDK 17 as this is supposed to handle class file version 61.0, from what I read.

4. How can the community help?
Help point me to a resolution for this issue.

Helpful Posting Tips: Tips for Posting Questions that Get Answers [Hold down CTRL and link on link to open tips documents in a separate tab]

Hey, did you set the new java as the JAVA_HOME?
Greetings
Marvin

Can you try to “comment out” (add a # to the line) this line, JAVA=/usr/bin/java, in your JVM settings file? Should be /etc/sysconfig/graylog-server for RPM/yum installs.

Should look like this when commented out
image

This will allow graylog to use its bundled JDK and no longer rely on the OS jdk.

@drewmiranda-gl Thank you, I did as you instructed and then got the error message in the logs that says this:
graylog-server[5230]: Unrecognized VM option ‘UseConcMarkSweepGC’
Jun 14 11:30:10 graylog-server[5230]: Error: Could not create the Java Virtual Machine.
Jun 14 11:30:10 graylog-server[5230]: Error: A fatal exception has occurred. Program will exit.
Jun 14 11:30:10 systemd[1]: graylog-server.service: Main process exited, code=exited, status=1/FAILURE
Jun 14 11:30:10 systemd[1]: graylog-server.service: Failed with result ‘exit-code’.

So I then re-edited the /etc/sysconfig/graylog-server file and also commented out the setting below:
#GRAYLOG_SERVER_JAVA_OPTS=“-Xms2g -Xmx2g -XX:NewRatio=1 -server -XX:+ResizeTLAB -XX:+UseConcMarkSweepGC -Dlog4j2.formatMsgNoLookups=true -XX:+CMSConcurrentMTEnabled -XX:+CMSClassUnloadingEnabled -XX:-OmitStackTraceInFastThrow”

I saved and quit the file and the started graylog-server service and that all fixed the issue.
Will I have any problems moving forward with commenting out the above setting for GRAYLOG_SERVER_JAVA_OPTS?

Thanks again for taking the time to help me out.

I recommend replacing that line with the updated defaults from fpm-recipes/recipes/graylog-server/files/environment at 5.0 · Graylog2/fpm-recipes · GitHub

GRAYLOG_SERVER_JAVA_OPTS="-Xms1g -Xmx1g -server -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow"

Change -Xms1g and -Xmx1g to another value if you need more heap space for graylog-server. Typically 1g is sufficient but in some scenarios with higher log throughput (message per second) 2g is needed to avoid random JVM out of memory crashes.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.