Ubuntu 22.04.3 LTS and Java 19 warning

Hi. I have VPS with Ubuntu Server 22.04.3 LTS and Neo4j 11.3 on it. When i start cypher-shell on server i recieve warning about Java version. Is it ok?

liv@singularity:~$cypher-shell
You are using an unsupported version of the Java runtime. Please use Java(TM) 17 or Java(TM) 21.
username: neo4j
password:
Connected to Neo4j using Bolt protocol version 5.3 at neo4j://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j@neo4j>:help

liv@singularity:~$ sudo systemctl status neo4j.service
[sudo] password for liv:
Ɨ neo4j.service - Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-11-08 14:38:02 +07; 2h 17min ago
Main PID: 235450 (code=exited, status=1/FAILURE)
CPU: 3.406s
Notice: journal has been rotated since unit was started, output may be incomplete.

Server is work, i cant connect to it in Neo4j Desktop the same time.

liv@singularity:~$ sudo systemctl restart neo4j.service
liv@singularity:~$ sudo systemctl status neo4j.service
Ɨ neo4j.service - Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-11-08 16:56:40 +07; 808ms ago
Process: 259389 ExecStart=/usr/share/neo4j/bin/neo4j console (code=exited, status=1/FAILURE)
Main PID: 259389 (code=exited, status=1/FAILURE)
CPU: 3.299s

Nov 08 16:56:38 singularity systemd[1]: Started Neo4j Graph Database.
Nov 08 16:56:40 singularity neo4j[259389]: Neo4j is already running (pid:184342).
Nov 08 16:56:40 singularity neo4j[259389]: Run with '--verbose' for a more detailed error message.
Nov 08 16:56:40 singularity systemd[1]: neo4j.service: Main process exited, code=exited, status=1/FAILURE
Nov 08 16:56:40 singularity systemd[1]: neo4j.service: Failed with result 'exit-code'.
Nov 08 16:56:40 singularity systemd[1]: neo4j.service: Consumed 3.299s CPU time.

liv@singularity:~$ sudo ps -ef | grep java
root 184342 1 0 08:21 ? 00:04:20 /usr/lib/jvm/java-19-openjdk-amd64/bin/java -cp /var/lib/neo4j/plugins/:/etc/neo4j/:/usr/share/neo4j/lib/* -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024 -Dio.netty.tryReflectionSetAccessible=true -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.server.CommunityEntryPoint --home-dir=/var/lib/neo4j --config-dir=/etc/neo4j

liv@singularity:~$ sudo cypher-shell
You are using an unsupported version of the Java runtime. Please use Java(TM) 17 or Java(TM) 21.
username: neo4j
password:
Connected to Neo4j using Bolt protocol version 5.3 at neo4j://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j@neo4j>

Is it magic?

This happens because Ubuntu "helpfully" installs the very latest version of java available, even if it's not the right dependency of the package being installed. This is probably why Java 19 got installed for you.

It would be best to install java 17 (or 21 if you prefer) and uninstall java 19. We don't test neo4j against java 19, so there's a chance something won't work, even if neo4j does successfully start up.

2 Likes

sudo apt install openjdk-17-jdk openjdk-17-jre
sudo update-alternatives --config java
liv@singularity:~$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
*0 /usr/lib/jvm/java-19-openjdk-amd64/bin/java 1911 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
2 /usr/lib/jvm/java-17-openjdk-amd64/bin/java 1711 manual mode
3 /usr/lib/jvm/java-19-openjdk-amd64/bin/java 1911 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-17-openjdk-amd64/bin/java to provide /usr/bin/java (java) in manual mode

After than cypher-shell and Neo4j server started without warnings.

Strange, but true?

liv@singularity:~$ sudo systemctl status neo4j.service
[sudo] password for liv:
Ɨ neo4j.service - Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2023-11-09 09:25:38 +07; 1 day 2h ago
Main PID: 443790 (code=exited, status=1/FAILURE)
CPU: 3.419s

Notice: journal has been rotated since unit was started, output may be incomplete.

I still have FAILURE status for neo4j.service, and i can connect to service?
liv@singularity:~$ cypher-shell

username: neo4j
password:
Connected to Neo4j using Bolt protocol version 5.3 at neo4j://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j@neo4j>

How it is possible?

liv@singularity:~$ sudo ps -ef | grep java
root 184342 1 0 Nov08 ? 00:21:13 /usr/lib/jvm/java-19-openjdk-amd64/bin/java -cp /var/lib/neo4j/plugins/:/etc/neo4j/:/usr/share/neo4j/lib/* -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024 -Dio.netty.tryReflectionSetAccessible=true -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.server.CommunityEntryPoint --home-dir=/var/lib/neo4j --config-dir=/etc/neo4j
liv 739484 727238 0 11:41 pts/6 00:00:00 grep --color=auto java

Again Java 19 instead of 17!

liv@singularity:~$ sudo systemctl stop neo4j.service
liv@singularity:~$ sudo systemctl status neo4j.service
Ɨ neo4j.service - Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2023-11-09 09:25:38 +07; 1 day 2h ago
Main PID: 443790 (code=exited, status=1/FAILURE)
CPU: 3.419s

Notice: journal has been rotated since unit was started, output may be incomplete.
liv@singularity:~$ sudo ps -ef | grep java
root 184342 1 0 Nov08 ? 00:21:14 /usr/lib/jvm/java-19-openjdk-amd64/bin/java -cp /var/lib/neo4j/plugins/:/etc/neo4j/:/usr/share/neo4j/lib/* -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024 -Dio.netty.tryReflectionSetAccessible=true -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.server.CommunityEntryPoint --home-dir=/var/lib/neo4j --config-dir=/etc/neo4j
liv 739877 727238 0 11:44 pts/6 00:00:00 grep --color=auto java

Who start this process?

liv@singularity:~$ sudo kill 184342
liv@singularity:~$ sudo systemctl start neo4j.service
liv@singularity:~$ sudo systemctl status neo4j.service
ā— neo4j.service - Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-11-10 11:46:52 +07; 9s ago
Main PID: 740381 (java)
Tasks: 71 (limit: 2212)
Memory: 457.1M
CPU: 12.502s
CGroup: /system.slice/neo4j.service
ā”œā”€740381 /usr/bin/java -Xmx128m -classpath "/usr/share/neo4j/lib/:/usr/share/neo4j/etc:/usr/share/neo4j/repo/" -Dapp.name=neo4j -Dapp.pid=740381 -Dapp.repo=/usr/share/neo4j/r>
ā””ā”€740413 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -cp "/var/lib/neo4j/plugins/:/etc/neo4j/:/usr/share/neo4j/lib/*" -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysP>

Nov 10 11:46:55 singularity neo4j[740413]: 2023-11-10 04:46:55.805+0000 INFO Starting...
Nov 10 11:46:57 singularity neo4j[740413]: 2023-11-10 04:46:57.088+0000 INFO This instance is ServerId{b3a18ea2} (b3a18ea2-a71e-4233-a748-692c24c6eaea)
Nov 10 11:46:58 singularity neo4j[740413]: 2023-11-10 04:46:58.069+0000 INFO ======== Neo4j 5.13.0 ========
Nov 10 11:46:59 singularity neo4j[740413]: 2023-11-10 04:46:59.451+0000 INFO Bolt enabled on localhost:7687.
Nov 10 11:47:00 singularity neo4j[740413]: 2023-11-10 04:47:00.265+0000 INFO HTTP enabled on localhost:7474.
Nov 10 11:47:00 singularity neo4j[740413]: 2023-11-10 04:47:00.266+0000 INFO Remote interface available at http://localhost:7474/
Nov 10 11:47:00 singularity neo4j[740413]: 2023-11-10 04:47:00.269+0000 INFO id: 374703ABA4DDF840F4315A4C7AC462838DCC4D0D2B6EE3EE077B3B7248CA8F52
Nov 10 11:47:00 singularity neo4j[740413]: 2023-11-10 04:47:00.269+0000 INFO name: system
Nov 10 11:47:00 singularity neo4j[740413]: 2023-11-10 04:47:00.269+0000 INFO creationDate: 2023-11-06T03:51:13.375Z
Nov 10 11:47:00 singularity neo4j[740413]: 2023-11-10 04:47:00.270+0000 INFO Started.