Why cannot I display the JSP webpage Verification Code under WebLogic ?? (Very useful)

Source: Internet
Author: User

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
 
  1. # Initialize the common environment.
  2. 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
 
  1. $ {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 ");

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.