# Java version issue?

**URL:** <https://community.graylog.org/t/java-version-issue/29152>\
**Category:** Graylog Central (peer support)\
**Created:** [June 13, 2023, 11:39pm UTC](https://community.graylog.org/t/java-version-issue/29152 "2023-06-13T23:39:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![grace2023](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@grace2023](https://community.graylog.org/u/grace2023)\
**Post date:** [June 13, 2023, 11:39pm UTC](https://community.graylog.org/t/java-version-issue/29152/1 "2023-06-13T23:39:14Z")

</div>

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](https://community.graylog.org/t/tips-for-posting-questions-that-get-answers/21828) [Hold down CTRL and link on link to open tips documents in a separate tab]

---

<div class="post-metadata">

**Author:** ![Marvin1](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@Marvin1](https://community.graylog.org/u/Marvin1)\
**Post date:** [June 14, 2023, 2:49pm UTC](https://community.graylog.org/t/java-version-issue/29152/2 "2023-06-14T14:49:32Z")

</div>

Hey, did you set the new java as the JAVA\_HOME?  
Greetings  
Marvin

---

<div class="post-metadata">

**Author:** ![drewmiranda-gl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/drewmiranda-gl/32/13376_2.png) [@drewmiranda-gl](https://community.graylog.org/u/drewmiranda-gl)\
**Post date:** [June 14, 2023, 5:05pm UTC](https://community.graylog.org/t/java-version-issue/29152/3 "2023-06-14T17:05:23Z")

</div>

Can you try to “comment out” (add a `#` to the line) this line, `JAVA=/usr/bin/java`, in your [JVM settings](https://go2docs.graylog.org/5-0/setting_up_graylog/default_file_locations.html) file? Should be `/etc/sysconfig/graylog-server` for RPM/yum installs.

Should look like this when commented out  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/1/14a3ac27f004756a8e433929381d9879e47ce3ef.png)

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

---

<div class="post-metadata">

**Author:** ![grace2023](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@grace2023](https://community.graylog.org/u/grace2023)\
**Post date:** [June 14, 2023, 5:36pm UTC](https://community.graylog.org/t/java-version-issue/29152/4 "2023-06-14T17:36:19Z")

</div>

> [@drewmiranda-gl](#):
>
> ine, `JAV`

## @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.

---

<div class="post-metadata">

**Author:** ![drewmiranda-gl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/drewmiranda-gl/32/13376_2.png) [@drewmiranda-gl](https://community.graylog.org/u/drewmiranda-gl)\
**Post date:** [June 14, 2023, 6:42pm UTC](https://community.graylog.org/t/java-version-issue/29152/5 "2023-06-14T18:42:30Z")

</div>

I recommend replacing that line with the updated defaults from [fpm-recipes/recipes/graylog-server/files/environment at 5.0 · Graylog2/fpm-recipes · GitHub](https://github.com/Graylog2/fpm-recipes/blob/5.0/recipes/graylog-server/files/environment)

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [June 28, 2023, 6:43pm UTC](https://community.graylog.org/t/java-version-issue/29152/6 "2023-06-28T18:43:11Z")

</div>

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