简体   繁体   English

java.lang.NoClassDefFoundError:无法初始化类javax.imageio.ImageIO jboss EAP 6

[英]java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO jboss EAP 6

We are using the JBoss EAP 6; 我们正在使用JBoss EAP 6; Everything works well till production environment. 一切都运作良好,直到生产环境。 But Post deployment in production, we are getting the below error: 但是在生产中部署后,我们得到以下错误:

java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO 

The error happening in one of the servlet where we are creating the Captcha. 在我们创建Captcha的servlet之一中发生错误。 This is the line where this error is happening : 这是发生此错误的行:

ImageIO.write(bufferedImage, "png", baos); 

Here is the stack trace for the Error : 这是错误的堆栈跟踪:

Server:server-three] Caused by: java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO
[Server:server-three]   at org.fwcms.tc.servlet.Captcha.doGet(Captcha.java:150) [classes:]
[Server:server-three]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec.jar:1.0.2.Final-redhat-1]
[Server:server-three]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec.jar:1.0.2.Final-redhat-1]
[Server:server-three]   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb.jar:7.2.2.Final-redhat-1]
[Server:server-three]   ... 36 more

This is not happening any other environments. 这不会发生在任何其他环境中。 We are deploying the app as ear. 我们正在部署应用程序。 Any suggestion/pointers in resolving this will help me a lot. 解决这个问题的任何建议/指示都会对我有所帮助。

Thank you in advance. 先感谢您。

Regards, Manjunath 问候,Manjunath

I found solution. 我找到了解决方案 You have to inicializate ImageIO before other operations. 您必须在其他操作之前初始化ImageIO。 You can do this by adding: 你可以通过添加:

static {
        ImageIO.scanForPlugins();
}

eg into your Main class. 例如进入你的主类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法初始化类 javax.imageio.ImageIO - Could not initialize class javax.imageio.ImageIO Tomcat 服务器在移入 docker 容器后生成 `Could not initialize class javax.imageio.ImageIO` 错误 - Tomcat server generates `Could not initialize class javax.imageio.ImageIO` error after being moved into a docker container java.lang.NoClassDefFoundError:无法在Jboss 5.0 EAP上初始化类org.apache.poi.POIXMLDocument - java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.POIXMLDocument on Jboss 5.0 EAP 无法在WAS 8.5中加载javax.imageio.ImageIO类 - Not able to load javax.imageio.ImageIO class in WAS 8.5 导入java.awt.xxxxx和javax.imageio.imageIO吗? - Import java.awt.xxxxx and javax.imageio.imageIO? java.lang.NoClassDefFoundError:无法初始化类 - java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO 文件格式常量 - javax.imageio.ImageIO file format constants java.lang.NoClassDefFoundError:无法初始化类 - java.lang.NoClassDefFoundError: Could not initialize class java.lang.NoClassDefFoundError:无法初始化类javax.media.jai.JAI - java.lang.NoClassDefFoundError: Could not initialize class javax.media.jai.JAI java.lang.NoClassDefFoundError:无法初始化类javax.swing.UIManager - java.lang.NoClassDefFoundError: Could not initialize class javax.swing.UIManager
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM