[英]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.