4

I've installed GeoServer by:

1 Installing Java JDK 18 with the x64 Installer

C:\>java -version
java version "18.0.1.1" 2022-04-22
Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
Java HotSpot(TM) 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)

2 Downloading and extracting Platform Independent Binary to D:\Program\GeoServer

3 Creating the environmental system variables
JAVA_HOME : D:\Program\Java

GEOSERVER_HOME : D:\Program\GeoServer

GEOSERVER_DATA_DIR : D:\Program\GeoServer\data_dir

The server starts and I can access the admin interface (http://localhost:8080/geoserver/web/) but I cant access the wms services at http://localhost:8080/geoserver/wms (Failed to parse capabilities), I cant preview the layers, and when I click "Server status" in the admin interface I get

HTTP ERROR 500 javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE ...

Is there a problem with Java, or what is the problem?

2 Answers 2

6

GeoServer supported JRE/JDK for current versions (2.20.x and 2.21.x) are 11 and 8.

GeoServer 2.21.0 has experimental support for Java 17 (it can build on it, but there is no guarantee about running on it, it's not being used for production usage).

That said... with an error like "Could not initialize class java.awt.GraphicsEnvironment" it might well be that you are running it in a headless environment, and forgot to tell Java about it. Try also adding "-Djava.awt.headless=true" to the Java command line starting GeoServer (can Windows run headless these days?). I'd also recommend sharing a longer stack trace.

0
5

Currently (May 2022) Java 17 is experimentally supported and Java 11 is recommended. So it looks like Java 18 is not working for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.