weblogic环境,应用上传图片报Could not initialize class sun.awt.X11.XToolkit
问题描写叙述
遇到的问题是在weblogic环境,应用在上传图片的时候报Could not initialize class sun.awt.X11.XToolkit 错误。
详细错误例如以下
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.XToolkit
at 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)
解决的方法
在启动javaserver的时候。在启动參数中增加下面參数
-Djava.awt.headless=true
headless问题探讨
关于javaserver的headless模式。oracle官网的说明为:
http://www.oracle.com/technetwork/articles/javase/headless-136834.html
当中非常多概念我也不是非常理解
大致意思就是,在javaserver端,有很多图形界面的处理函数。须要调用显示器,鼠标键盘这些设备,但有些处理函数则不须要。假设设置了这个headless之后。图形界面的处理和渲染是分开的,用于生成图片的工作放在server端进行,生成后将编码传到client,再在client进行渲染和显示。
这主要用了server端的高计算能力。然后把须要调用显示器相关的工作传到client去运行。
以上的错误本身是要初始化X11server。然后用X11的工具箱去做图形生成计算这等事。可是X11初始化失败。应该是X11的安装环境有问题,于是能够设置java參数
-Djava.awt.headless=true
这个參数。使用java自带的这个server工具箱。
以上是我的理解,对错有待验证。
weblogic环境,应用上传图片报Could not initialize class sun.awt.X11.XToolkit的更多相关文章
- weblogic .NoClassDefFoundError: Could not initialize class sun.awt.X11Graphi
这个是常见问题,可以通过增加Weblogic的启动参数来解决: -Djava.awt.headless=true 你可以修改 startWebLogic.sh 文件. export JAVA_OPTI ...
- 关于使用Xshell远程连接启动tomcat导致图片不显示,报错Could not initialize class sun.awt.X11GraphicsEnvironment解决方案
如果您是使用xshell远程启动tomcat,导致二维码.验证码,头像等各种图片不显示,并且打开图片链接报错Could not initialize class sun.awt.X11Graphics ...
- Linux下验证码无法显示,Could not initialize class sun.awt.X1 解决方案
环境:Oracle Linux 6.4,JDK1.6,Weblogic11g 在通过java.awt生成图片验证码时,提示: Could not initialize class sun.awt.X1 ...
- java:提示Could not initialize class sun.awt.X11GraphicsEnvironment
前几天发现tomcat提示 Could not initialize class sun.awt.X11GraphicsEnvironment 问题.以为不验证,就没太关注,今天发现,有同事提示了个 ...
- linux下验证码无法显示:Could not initialize class sun.awt.X1 解决方案
转自:http://my.oschina.net/xiangtao/blog/28441 网站验证码突然无法显示,并报如下错误. Caused by: java.lang.NoClassDefFoun ...
- exception java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
exception java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironmen ...
- no jpeg in java.library.path;java.lang.NoClassDefFoundError: Could not initialize class sun.awt.image.codec.JPEGImageEncoderImpl
no jpeg in java.library.path;java.lang.NoClassDefFoundError: Could not initialize class sun.awt.imag ...
- 验证码无法正常显示,提示Could not initialize class sun.awt.X11GraphicsEnvironment
在Web开发中使用验证码时可能遇到的问题:java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsE ...
- java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
请求验证码时后台报错:java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment ...
随机推荐
- 图片转换成Base64编码集成到html文件
首先为什么要这么做? 原因很简单这样可以减少与服务器的请求,当然对于一些浏览器并不支持,如IE8.通常用在手机版网站中,具体转化方法如下: 1.在线打开Base64的编码器将图片编码成Base64 ...
- linux内核中send与recv函数详解
Linux send与recv函数详解 1.简介 #include <sys/socket.h> ssize_t recv(int sockfd, void *buff, size_t n ...
- EasyUI - DataGrid 组建 - [ 组件加载和分页 ]
效果: 原理:通过POST传递到数据后台字段. 此时上传的参数,page:当前页数,rows:每页显示的页数. 有此两项参数,计算取出数据条数. 通过后台接受参数,进行处理并返回抽取的数据. html ...
- sql:oracle, CURSOR
CursorsYou use a cursor to fetch rows returned by a query. You retrieve the rows into the cursor usi ...
- QNX简介<转载>
QNX QNX是由QNX软件系统有限公司开发的实时操作系统. http://blog.csdn.net/happyhell/article/details/7087199 基本特征 * QNX是一个 ...
- 深入浅出Hadoop实战开发(HDFS实战图片、MapReduce、HBase实战微博、Hive应用)
Hadoop是什么,为什么要学习Hadoop? Hadoop是一个分布式系统基础架构,由Apache基金会开发.用户可以在不了解分布式底层细节的情况下,开发分布式程序.充分利用集群的威力高速运 ...
- 通过判断浏览器的userAgent,用正则来判断是否是ios和Android客户端
<script type="text/javascript">var u = navigator.userAgent, app = navigator.appVersi ...
- ZYNQ-7000 Unable to connect to ps7_cortexa9 解决方案
图1 开发工具:Xilinx SDk 14.4(基于Eclipse,ISE suite 14.4组件之一) 开发板:Xilinx ZYNQ-7000 zc702 rev 1.0(注意:这个板子的版本说 ...
- 使用高德地图API
http://lbs.amap.com/smart/map/developer/mode/ 简单的附上一张图,其实能做得比这个更强大.
- May Day Holiday
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Submit Status Practic ...