我是在项目添加了javax.mail包以后,使用 MimeUtility.encodeText 进行编码时遇到的。
22:57:01,550 ERROR [stderr] (web-container-thread-2) Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeUtility from [Module "deployment.datacollect.war:main" from Service Module Loader] 22:57:01,550 ERROR [stderr] (web-container-thread-2) at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) 22:57:01,550 ERROR [stderr] (web-container-thread-2) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) 22:57:01,550 ERROR [stderr] (web-container-thread-2) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) 22:57:01,550 ERROR [stderr] (web-container-thread-2) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:399) 22:57:01,551 ERROR [stderr] (web-container-thread-2) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) 22:57:01,551 ERROR [stderr] (web-container-thread-2) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) 22:57:01,551 ERROR [stderr] (web-container-thread-2) ... 53 more
最后查的结果是因为jboss需要自己设置输出哪些模块,如果报这种类找不到com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeUtility,
就把前面这一串小写的这部分com.sun.xml.internal.messaging.saaj.packaging.mime.internet
改成<path name="com/sun/xml/internal/messaging/saaj/packaging/mime/internet"/>
添加到jboss_home\modules\system\layers\base\sun\jdk\main\module.xml 文件中的paths中,重启jboss就ok了
<module xmlns="urn:jboss:module:1.1" name="sun.jdk"> <resources> <!-- currently jboss modules has not way of importing services from classes.jar so we duplicate them here --> <resource-root path="service-loader-resources"/> </resources> <dependencies> <system export="true"> <paths> <path name="com/sun/xml/internal/messaging/saaj/packaging/mime/internet"/> <path name="com/sun/script/javascript"/> <path name="com/sun/image/codec/jpeg"/> <path name="com/sun/imageio/plugins/bmp"/> <path name="com/sun/imageio/plugins/common"/> <path name="com/sun/imageio/plugins/gif"/>
参考文档:http://www.cnblogs.com/yjmyzz/p/4447291.html
© 2018, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com