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( at org.apache.poi.openxml4j.opc.OPCPackage.( at org.apache.poi.openxml4j.opc.Package.( at org.apache.poi.openxml4j.opc.ZipPackage.( at at at org.apache.poi.xwpf.usermodel.XWPFDocument.( ... Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation( at org.apache.felix.framework.ModuleImpl.access$100( at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at java.lang.ClassLoader.loadClassInternal( ... 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 答疑

评论 抢沙发

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

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