In the weblogic environment, the application uploads an image and reports cocould not initialize class sun. awt. X11.XToolkit,

Source: Internet
Author: User

In the weblogic environment, the application uploads an image and reports cocould not initialize class sun. awt. X11.XToolkit,
Problem description

The problem is that in the weblogic environment, the application reports the cocould not initialize class sun. awt. X11.XToolkit error when uploading images.

The specific error is as follows:

17:57:02 [AWT-EventQueue-2] DEBUG - Leaving class nc.ui.hi.psndoc.action.SavePsndocAction.actionPerformed Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkitat java.lang.Class.forName0(Native Method)at java.lang.Class.forName(Class.java:169)at java.awt.Toolkit$2.run(Toolkit.java:834)at java.security.AccessController.doPrivileged(Native Method)at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826)at javax.swing.ImageIcon.<init>(ImageIcon.java:236)at nc.pub.tools.VOUtils.transPreviewPhoto(VOUtils.java:212)at nc.impl.hi.psndoc.PsndocValidator.setPreviewPhoto(PsndocValidator.java:1338)at nc.impl.hi.psndoc.PsndocValidator.adjustPsndoc(PsndocValidator.java:1320)at nc.impl.hi.psndoc.PsndocValidator.validate(PsndocValidator.java:819)at nc.impl.hi.psndoc.PsndocServiceImpl.savePsndoc(PsndocServiceImpl.java:1616)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at nc.bs.framework.aop.rt.MethodProceedingJoinpoint$3.invoke(MethodProceedingJoinpoint.java:74)at nc.bs.framework.aop.rt.MethodProceedingJoinpoint.proceed(MethodProceedingJoinpoint.java:184)at nc.bs.framework.server.SecurityAspect.aroundMethod1(SecurityAspect.java:45)at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at nc.bs.framework.aop.rt.AdviceHolder.invoke(AdviceHolder.java:182)at nc.bs.framework.aop.rt.MethodProceedingJoinpoint.proceed(MethodProceedingJoinpoint.java:129)at nc.bs.framework.aop.rt.MethodProceedingJoinpoint.proceed(MethodProceedingJoinpoint.java:135)at nc.bs.aop.log.BusilogAspect.aroundMethod(BusilogAspect.java:75)at sun.reflect.GeneratedMethodAccessor1769.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at nc.bs.framework.aop.rt.AdviceHolder.invoke(AdviceHolder.java:182)at nc.bs.framework.aop.rt.MethodProceedingJoinpoint.proceed(MethodProceedingJoinpoint.java:129)at nc.bs.framework.aop.rt.MethodProceedingJoinpoint.proceed(MethodProceedingJoinpoint.java:135)at nc.bs.framework.aop.rt.AspectedProxy.invoke(AspectedProxy.java:59)at $Proxy519.savePsndoc(Unknown Source)at nc.itf.hr.hi.HRhiEJBEjbBean.savePsndoc(HRhiEJBEjbBean.java:2812)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)at $Proxy514.savePsndoc(Unknown Source)

Solution

When starting the java Server, add the following parameters to the startup parameters:

-Djava.awt.headless=true

Headless Problems

For the headless mode of the java Server, the Instructions on the oracle official website are as follows:

Http://www.oracle.com/technetwork/articles/javase/headless-136834.html

I am not very familiar with many of these concepts.

The general meaning is that on the java server, there are many graphic interface processing functions that need to call the display, mouse, and keyboard devices, but some processing functions are not required. If this headless is set, the processing and rendering of the graphic interface are separated. The image generation work is carried out on the server side. After the image is generated, the code is uploaded to the client side for rendering and display on the client side.

This mainly uses the high computing capability of the server, and then transmits the work related to the display to the client for execution.

The above error itself is to initialize the X11 server, and then use the X11 toolbox to do graphics generation computing, but the X11 initialization fails, it should be a problem with the X11 installation environment, you can set java parameters.

-Djava. awt. headless = true

This parameter uses the server toolbox that comes with java.


The above is my understanding, and the right and wrong are to be verified.


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.