我整天都在用我的应用程序运行一个 grails 测试运行应用程序,这很好。我键入“grails prod war”来进行战争,并将其部署在我的 linux 操作系统的 Jboss 6.0 中。使用 docx4j.jar 的 WordprocessingMLPackage.load(inputStream) 方法读取 docx 文件时出现错误:
WordprocessingMLPackage inputMLPackage = WordprocessingMLPackage.load(inputStream);
2012-10-31 06:32:54,861 ERROR [org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver] (http-10.189.8.11-8080- 2) Exception occurred when processing request: [POST] /HBG_PM/report/buildItinerary
Stacktrace follows:: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [buildItinerary] of controller [com.hbg.pm.controller.report.ReportController] caused exception: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
at java.lang.Thread.run(Thread.java:679) [:1.6.0_22]
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context
... 8 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:666) [:]
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206) [:]
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193) [:]
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301) [:]
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245) [:]
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:213) [:]
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:184) [:]
at org.docx4j.openpackaging.packages.WordprocessingMLPackage$load.call(Unknown Source)
at com.hbg.pm.controller.report.ReportController.processBodyHeaderFooter(ReportController.groovy:2517) [:]
at com.hbg.pm.controller.report.ReportController$_closure1.doCall(ReportController.groovy:198) [:]
at com.hbg.pm.controller.report.ReportController$_closure1.doCall(ReportController.groovy) [:]
... 8 more
如果我尝试使用动态 Web 项目做同样的事情,则没有错误。这是什么原因造成的?因为我的网络 inf 库中有 docx4j jar
谢谢