java.lang.NoClassDefFoundError:无法初始化类javax.imageio.ImageIO jboss EAP 6 [英] java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO jboss EAP 6
问题描述
我们正在使用JBoss EAP 6;一切都运作良好,直到生产环境。但是在生产中部署后,我们得到以下错误:
We are using the 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
我们正在创建Captcha的一个servlet中发生错误。这是发生此错误的行:
The error happening in one of the servlet where we are creating the Captcha. 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.
提前谢谢你。
问候,
Manjunath
Regards, Manjunath
推荐答案
我找到了解决方案。
您必须在其他操作之前使用ImageIO。
你可以通过添加:
I found solution. You have to inicializate ImageIO before other operations. You can do this by adding:
static {
ImageIO.scanForPlugins();
}
例如进入您的Main类。
eg into your Main class.
这篇关于java.lang.NoClassDefFoundError:无法初始化类javax.imageio.ImageIO jboss EAP 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!