我的grails项目中的jar在部署到tomcat 5.5时没有被拾取

时间:2010-11-11 21:48:59

标签: java tomcat grails

我正在使用我的应用程序整天运行grails test run-app,这很好。我键入“grails prod war”来获取战争,并将其转储到我的tomcat安装的webapps文件夹中。现在我得到这样的信息:

11.11.2010 16:35:11 *ERROR* GrailsExceptionResolver: Executing action [index] of controller [ResumeController]  caused e
xception: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context (GrailsExceptionResolver.ja
va, line 72)
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [index] of controll
er [ResumeController]  caused exception: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Cont
ext
        at org.jsecurity.web.servlet.JSecurityFilter.doFilterInternal(JSecurityFilter.java:382)
        at org.jsecurity.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:180)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: Could not initialize
class org.docx4j.jaxb.Context
        ... 3 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context
        at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:599)
        at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:199)
        at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:188)
        at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:188)
        at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:169)
        at com.iai.skillsdb.DocxHelpers.DocxParser.openDocx4j(DocxParser.java:70)
        at ResumeController$_closure8.doCall(ResumeController.groovy:164)
        at ResumeController$_closure8.doCall(ResumeController.groovy)
        at ResumeController.invokeMethod(ResumeController.groovy)
        at ResumeController$_closure1.doCall(ResumeController.groovy:41)
        at ResumeController$_closure1.doCall(ResumeController.groovy)
        ... 3 more

造成这种情况的原因是什么?我肯定在我的WAR中有docx4j jar,它也存在于web-inf lib文件夹中。

2 个答案:

答案 0 :(得分:3)

您获得的是java.lang.NoClassDefFoundError,而不是java.lang.ClassNotFoundException。正在加载该类,但它所依赖的类(直接或间接通过另一个类)不存在。您很可能错过了docx4j作为依赖项所需的jar。

答案 1 :(得分:0)

确保您拥有正确版本的docx4j,并且您的类路径中绝对没有其他版本的docx4j,可能有一个版本的lib没有实现“Content”类。