M
megger
Gast
guten morgen leute,
ich hab das problem, dass ich auf einem linux-system beim aufruf von java-charting-funktionen (diagramme usw.) eine "headless exception" als fehlermeldung bekomme..bei meinem application-server (coldfusion) wird als jvm-argument auch ein Djava.awt.headless=true mitgegeben, das sollte eigentlich so passen!?
nochmal der fehler: java.awt.HedlessException
wäre super, wenn jemand ne idee hätte, wo ich drehen kann..diesen beitrag hab ich schon gefunden, aber da steht ja nur, dass ich java mit headless=true starten soll, was ich ja bei meinem application-server als paramter mit angebe..oder kann ich das noch woanders eingeben bzw. wie überprüfen, ob das headless=true auch wirklich aktiv ist?
-----------------------------------------beitrag start----------------------------------------------------------------------
Headless Support
The bugtraq report that corresponds to this change is: 4281163.
Many environments, such as mainframe machines and dedicated servers, do not support a display, keyboard, or mouse. Headless support is enabled by the new GraphicsEnvironment methods isHeadless and isHeadlessInstance. These methods indicate whether a display, keyboard, and mouse can be supported in a graphics environment.
The API changes for headless include:
A new public exception class, java.awt.HeadlessException, is introduced. It is derived from UnsupportedOperationException, which derives from RuntimeException, so that existing implementations of methods that throw the new exception will not require signature changes.
Two new methods, are added to java.awt.GraphicsEnvironment.
public static boolean isHeadless()
public boolean isHeadlessInstance()
The constructors of Applet and all heavyweight components (*) are changed to throw HeadlessException if a display, keyboard, and mouse are not supported by the toolkit implementation. All javadoc tags on all constructors are changed to reflect this RuntimeException.
The Robot constructor throws an AWTException if a display, keyboard, and mouse are not supported by the toolkit implementation.
Many of the methods in Toolkit and GraphicsEnvironment, with the exception of fonts, imaging, and printing, are changed to throw HeadlessException if a display, keyboard, and mouse are not supported. All the javadoc tags on these methods are changed to reflect this RuntimeException.
Other methods that may be affected by lack of display, keyboard, or mouse support, are changed to throw HeadlessException.
It should be worth noting that the HeadlessException is thrown if and only if isHeadless returns true, and that all javadoc comments should specify this.
(*)Applet, Button, Checkbox, Choice, FileDialog, Label, List, Menu, MenuBar, MenuComponent, MenuItem, PopupMenu, Scrollbar, ScrollPane, TextArea, TextComponent, Frame, Window, Dialog, JApplet, JFrame, JWindow, JDialog, and TextField. Canvas and Panel do not need to throw this exception since these can be given empty peers and treated as lightweights.
To run our environment with a headless implementation, the follow property may be specified at the java command line:
-----------------------------------------beitrag ende----------------------------------------------------------------------
ich hab das problem, dass ich auf einem linux-system beim aufruf von java-charting-funktionen (diagramme usw.) eine "headless exception" als fehlermeldung bekomme..bei meinem application-server (coldfusion) wird als jvm-argument auch ein Djava.awt.headless=true mitgegeben, das sollte eigentlich so passen!?
nochmal der fehler: java.awt.HedlessException
wäre super, wenn jemand ne idee hätte, wo ich drehen kann..diesen beitrag hab ich schon gefunden, aber da steht ja nur, dass ich java mit headless=true starten soll, was ich ja bei meinem application-server als paramter mit angebe..oder kann ich das noch woanders eingeben bzw. wie überprüfen, ob das headless=true auch wirklich aktiv ist?
-----------------------------------------beitrag start----------------------------------------------------------------------
Headless Support
The bugtraq report that corresponds to this change is: 4281163.
Many environments, such as mainframe machines and dedicated servers, do not support a display, keyboard, or mouse. Headless support is enabled by the new GraphicsEnvironment methods isHeadless and isHeadlessInstance. These methods indicate whether a display, keyboard, and mouse can be supported in a graphics environment.
The API changes for headless include:
A new public exception class, java.awt.HeadlessException, is introduced. It is derived from UnsupportedOperationException, which derives from RuntimeException, so that existing implementations of methods that throw the new exception will not require signature changes.
Two new methods, are added to java.awt.GraphicsEnvironment.
public static boolean isHeadless()
public boolean isHeadlessInstance()
The constructors of Applet and all heavyweight components (*) are changed to throw HeadlessException if a display, keyboard, and mouse are not supported by the toolkit implementation. All javadoc tags on all constructors are changed to reflect this RuntimeException.
The Robot constructor throws an AWTException if a display, keyboard, and mouse are not supported by the toolkit implementation.
Many of the methods in Toolkit and GraphicsEnvironment, with the exception of fonts, imaging, and printing, are changed to throw HeadlessException if a display, keyboard, and mouse are not supported. All the javadoc tags on these methods are changed to reflect this RuntimeException.
Other methods that may be affected by lack of display, keyboard, or mouse support, are changed to throw HeadlessException.
It should be worth noting that the HeadlessException is thrown if and only if isHeadless returns true, and that all javadoc comments should specify this.
(*)Applet, Button, Checkbox, Choice, FileDialog, Label, List, Menu, MenuBar, MenuComponent, MenuItem, PopupMenu, Scrollbar, ScrollPane, TextArea, TextComponent, Frame, Window, Dialog, JApplet, JFrame, JWindow, JDialog, and TextField. Canvas and Panel do not need to throw this exception since these can be given empty peers and treated as lightweights.
To run our environment with a headless implementation, the follow property may be specified at the java command line:
Code:
-Djava.awt.headless=true
Source code should check for headless, so that the exception may be caught gracefully. For example, see the following pre-headless implementation of the class Foo:
class Foo {
static Choice c = new Choice(); // could throw HeadlessException
}
The new and improved implementation of Foo should be placed in a static block:
class Foo {
static Choice c;
static {
try {
c = new Choice();
catch (HeadlessException e) {
...
}
}
}