diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index 0cb2166737..f576487db5 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -207,7 +207,7 @@ public final class Hudson extends View implements ItemGroup, Node, */ private transient final List widgets = new CopyOnWriteArrayList(); - private transient volatile DependencyGraph dependencyGraph = DependencyGraph.EMPTY; + private transient volatile DependencyGraph dependencyGraph; /** * Set of installed cluster nodes. @@ -285,6 +285,15 @@ public final class Hudson extends View implements ItemGroup, Node, throw new IllegalStateException("second instance"); theInstance = this; + try { + dependencyGraph = DependencyGraph.EMPTY; + } catch (InternalError e) { + if(e.getMessage().contains("window server")) { + throw new Error("Looks like the server runs without X. Please specify -Djava.awt.headless=true as JVM option",e); + } + throw e; + } + // load plugins. pluginManager = new PluginManager(context);