NoClassDefFoundError at Run time

I used `Apache POI` library in my application and uploaded into `JBoss AS 7.1` . It deployed the jar successfully and I was able to run the application with out any errors/exceptions, Where as the same jar if i deploy into `jboss-5.0.1.GA`. It is throwing the following exception. java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:154) at org.apache.poi.openxml4j.opc.OPCPackage.(OPCPackage.java:141) at org.apache.poi.openxml4j.opc.Package.(Package.java:54) at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:82) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:267) at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39) at org.apache.poi.xwpf.usermodel.XWPFDocument.(XWPFDocument.java:120) ... Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:738) at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60) at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 19 more If i add `dom4j` jar. It throws a new Exception that is java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory What would be the problem? Does `JBoss5` load classes differently from `JBoss7` ? What I am missing here? Note: My application is a standalone java application
The apparently ridiculous ClassCastException is a sure indication that you have the same class being loaded by two different class loaders. When this happens, the classes have the same fully-qualified name but are not compatible as far as the JVM is concerned. It is likely JBOSS loads an older dom4j that does not define DocumentException.

以上就是NoClassDefFoundError at Run time的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏