刚刚在一台Linux服务器上安装了jdk和Tomcat,然后部署了一个web项目,在项目中有个添加图片的功能,保存图片时报错

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.UnsatisfiedLinkError: /home/software/jdk1.7.0_65/jre/lib/i386/xawt/libmawt.so: libXext.so.6: cannot open shared object file: No such file or directory

网上说是jdk安装了32位的,应该安装64位的。然后我就将jdk删除重装了64位的。

如何查看jdk是多少位方法:

使用 java -version 即可。 
如果是安装了32位的jdk,则输出信息如下:

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) Server VM (build 25.144-b01, mixed mode)

上面的输出信息中没包含64bit。

如果是安装了64位的jdk,则输出信息如下:

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

jdk由32位改为64位后,启动项目,保存图片时又报错了,报错信息如下

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.

百度了一下这个问题,基本上都说是如下原因:

原因是windows内核集成了gui,而linux上没有启动x server

解决办法:
1。启动x server

2。在java运行参数上加-Djava.awt.headless=true 

我修改了应用服务器的启动文件。tomcat中的/bin/catalina.sh文件,
在所有的        -Dcatalina.home="$CATALINA_HOME" /下面都加上了

-Djava.awt.headless=true /
然后问题就解决了。

Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.的更多相关文章

  1. 【java异常】org.springframework.web.util.NestedServletException: Handler processing failed;Can't connect to X11 window server using 'localhost:10.0' as the value of th

    tomcat工程中创建二维码失败.抛出异常Can't connect to X11 window server using 'localhost:10.0' as the value of th 因为 ...

  2. Can't connect to X11 window server using 'localhost:0.0' 的解决

    Can't connect to X11 window server using 'localhost:0.0' 的解决 http://lufei-99999.blog.163.com/blog/st ...

  3. Linux 下centos7启动 Tomcat 抛出Can't connect to X11 window server 问题的解决方法

    1 问题 今天启动 Tomcat 后,登录页验证码不见了.在 localhost.xxx.log 发现以下错误: org.apache.catalina.core.StandardWrapperVal ...

  4. oracle Can't connect to X11 window server using ':0.0' /Checking monitor: must be configured to display at least 256 colors解决方法

    Can't connect to X11 window server using ':0.0' 解决方法 1. 以oracle 用户登陆X window 或者 2. root 身份执行 # xhost ...

  5. Java在Linux下 不能处理图形的解决办法 Can't connect to X11 window server

    java在图形处理时调用了本地的图形处理库.在利用Java作图形处理(比如:图片缩放,图片签名,生成报表)时,如果运行在windows上不会出问题.如果将程序移植到Linux/Unix上的时候有可能出 ...

  6. Can't connect to X11 window server using ':1.0' as the value of the DISPLAY variable.

    安装oracle数据时需要用到图形界面安装,当我们用root用户登录后切换到oracle用户时运行./runInstaller提示报错: Can't connect to X11 window ser ...

  7. Linux启动应用(比如jmeter)报An error occurred: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

    Linux启动应用(比如jmeter)报An error occurred: Can't connect to X11 window server using ':0.0' as the value ...

  8. Linux上 Can't connect to X11 window server using XX as the value of the DISPLAY 错误解决方法

    在Linux上运行需要图形界面的程序时出现如下错误提示: No protocol specified Exception in thread "main" java.awt.AWT ...

  9. java.awt.AWTError: Can't connect to X11 window server using ':20' as the value of the DISPLAY variable

    1.使用pio在Linux服务器上创建window文件时,需要使用到Linux的图形界面服务,出现以下问题需确认用户权限. 参考文献:https://zhidao.baidu.com/question ...

随机推荐

  1. JS函数动作分层结构详解及Document.getElementById 释义 js及cs数据类型区别 事件 函数 变量 script标签 var function

    html +css 静态页面 js     动态 交互   原理: js就是修改样式, 比如弹出一个对话框. 弹出的过程就是这个框由disable 变成display:enable. 又或者当鼠标指向 ...

  2. Spring Boot 整合 Thymeleaf 完整 Web 案例

    Thymeleaf 是一种模板语言.那模板语言或模板引擎是什么?常见的模板语言都包含以下几个概念:数据(Data).模板(Template).模板引擎(Template Engine)和结果文档(Re ...

  3. WPF控件相对位置解析

    WPF控件相对位置的获取方法是比较简单的.对于初学者来说,掌握这一技巧的应用,可以帮助以后对WPF的深入学习,而且在实际使用中,这是一个非常常用的方法. 我们知道WPF有着比较灵活的布局方式,关于某个 ...

  4. 关于ios 10 的新的部分

    编译器Xcode 8.2.1  SDK 10.2 1.   关于麦克风,相机,相册等部分的权限,需要在info.plist内进行设置,否则会出现crash.

  5. eclipse tomcat jdk 版本引用

    今日遇到一个问题,因为比较难找,所以记录下来,方便日后查阅,也许也可以帮助同行. 一个Java project工程,使用了solr6.2,所以需要引用jdk8才可以正常使用. 代码编写好了,已经提交s ...

  6. mysql获取表列信息、主键信息

    /** * 获取物理表中已存在的列信息 * @param tbName 表名 * @return results 查询结果 */ fun getExistColumnInfo(tbName:Strin ...

  7. Retrofit-入门使用

    1. 在模块目录下的build.gradle dependencies { compile "com.squareup.retrofit2:retrofit:2.1.0" comp ...

  8. 新款 2018款macbook Pro 装双系统教程

    首个阅读量将破万的文章,感谢支持.防止无良爬虫,开头附上原文链接:http://www.cnblogs.com/xueyudlut/p/7498115.html ------------------- ...

  9. markdown中设置、调整图片尺寸

    使用百分比描述尺寸 <img src="https://img2018.cnblogs.com/blog/1122471/201902/1122471-2019022218575673 ...

  10. Gradle入门实战(Windows版)

    Installation Gradle runs on all major operating systems and requires only a Java JDK or JRE version ...