The following error is reported:
Ava. Lang. noclassdeffounderror: cocould not initialize class sun. AWT. x11graphicsenvironment
At java. Lang. Class. forname0 (native method)
At java. Lang. Class. forname (class. Java: 169)
At java. AWT. graphicsenvironment. getlocalgraphicsenvironment (graphicsenvironment. Java: 68)
At java. AWT. image. bufferedimage. creategraphics (bufferedimage. Java: 1135)
At java. AWT. image. bufferedimage. getgraphics (bufferedimage. Java: 1125)
Truncated. See log file for complete stacktrace
Solution:
The first writing method:
Java code
- # Initialize the common environment.
- Java_options = "$ {java_options}-djava. AWT. Headless = true"
# Initialize the common environment. java_options = "$ {java_options}-djava. AWT. Headless = true"
The java_options parameter is loaded at the end of the file: $ {java_options}
Second writing mode: You can also directly add the row to the end of the file
Java code
- $ {Java_home}/bin/Java $ {java_vm }$ {mem_args }$ {java_options}-djava. AWT. headless = true-dweblogic. name =$ {SERVER_NAME}-dweblogic. productionmodeenabled =$ {production_mode}-djava. security. policy = "$ {wl_home}/Server/lib/weblogic. policy "weblogic. server
$ {Java_home}/bin/Java $ {java_vm }$ {mem_args }$ {java_options}-djava. AWT. headless = true-dweblogic. name =$ {SERVER_NAME}-dweblogic. productionmodeenabled =$ {production_mode}-djava. security. policy = "$ {wl_home}/Server/lib/weblogic. policy "weblogic. server
The two methods have the same effect.
The following is a post:
1. What is headless mode?
The headless mode is a system configuration mode. In this mode, the system lacks a display device, keyboard, or mouse.
2. When to use and headless mode?
Although the headless mode is not what we are willing to see, in fact, we often need to work in this mode, especially for server-side program developers. Because servers (such as hosts that provide Web services) may lack the aforementioned devices, but they need to use the functions they provide to generate corresponding data, to the client (such as the host with the relevant display device, keyboard, and mouse in the browser ).
3. How to Use headless mode?
Generally, when the program starts to activate the headless mode, tell the program that if you want to work in the headless mode, do not count on the hardware for help. You have to be self-reliant, these features are simulated based on the computing capability of the system:
System. setproperty ("Java. AWT. Headless", "true ");