这种情况是在Web应用程序中引发的,但在一个独立的应用程序中不会发生这种情况。任何想法,我使用docx4j 3.3.0。
运行Jboss 6.3的应用程序。
在使用旧版本(3.2.2)之前,但不会抛出此错误。
JBWEB000309: type JBWEB000066: Exception report
JBWEB000068: message Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
JBWEB000069: description JBWEB000145: The server encountered an internal error that prevented it from fulfilling this request.
JBWEB000070: exception
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1303)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:977)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
net.solser.admc.filter.RequestSecurityFilter.doFilter(RequestSecurityFilter.java:48)
net.solser.filter.compress.GzipFilter.doFilter(GzipFilter.java:35)
JBWEB000071: root cause
java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
org.docx4j.Docx4J.toPDF(Docx4J.java:592)
net.solsersistem.utils.pdf.PDFUtils.convertDocx4jToPDF(PDFUtils.java:45)
net.solser.admc.service.purchasingflow.PurchasingRequisitionService.sendFileToDownload(PurchasingRequisitionService.java:1190)
net.solser.admc.service.purchasingflow.PurchasingRequisitionService.sendFileToDownloadAndDeleteFile(PurchasingRequisitionService.java:1203)
net.solser.admc.service.purchasingflow.PurchasingRequisitionService.downloadDraftContract(PurchasingRequisitionService.java:349)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
net.solser.admc.filter.RequestSecurityFilter.doFilter(RequestSecurityFilter.java:48)
net.solser.filter.compress.GzipFilter.doFilter(GzipFilter.java:35)
JBWEB000071: root cause
java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest from [Module "deployment.EARAdmContractRest.ear:main" from Service Module Loader]
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
org.docx4j.Docx4J.toPDF(Docx4J.java:592)
net.solsersistem.utils.pdf.PDFUtils.convertDocx4jToPDF(PDFUtils.java:45)
net.solser.admc.service.purchasingflow.PurchasingRequisitionService.sendFileToDownload(PurchasingRequisitionService.java:1190)
net.solser.admc.service.purchasingflow.PurchasingRequisitionService.sendFileToDownloadAndDeleteFile(PurchasingRequisitionService.java:1203)
net.solser.admc.service.purchasingflow.PurchasingRequisitionService.downloadDraftContract(PurchasingRequisitionService.java:349)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
net.solser.admc.filter.RequestSecurityFilter.doFilter(RequestSecurityFilter.java:48)
net.solser.filter.compress.GzipFilter.doFilter(GzipFilter.java:35)
坦克和问候。
答案 0 :(得分:1)
看起来您正在转换为PDF。
根据http://www.docx4java.org/forums/announces/docx4j-3-3-0-released-t2381.html发行说明在v3.3.x中发生了变化:
默认PDF转换器已从XSL FO + Apache FOP更改为Plutext&#39 商业PDF转换器。基于XSL FO的PDF输出移至 新的/单独的项目docx4j-export-fo;之后我们做了这个改变 仔细考虑,因为质量/性能是如此之多 更好,它从docx4j本身删除各种依赖项。如果你 想要坚持现有的XSL FO + Apache FOP PDF转换,没有 probs: - 见下文。
使用converter-eval.plutext.com上的PDF Converter实例 默认,但您可以(并且应该!)在本地安装它;安装人员 可在http://converter-eval.plutext.com/
获取要使用您自己的实例,请设置docx4j属性,例如:
com.plutext.converter.URL = http://converter-eval.plutext.com:80/v1/00000000-0000-0000-0000-000000000000/convert
如果您想使用现有的XSL FO + Apache FOP PDF转换, 只需将docx4j-export-fo(+ deps)添加到您的类路径中。如果是这样的话 目前,docx4j将恢复为基于FO的转换。这些罐子是 在zip文件中,在dir optional / export-fo和Maven Central中。
使用默认PDF转换器(即商业版)时,您需要相关的docx4j 3.x依赖项,在本例中为https://github.com/plutext/docx4j/blob/master/pom.xml#L502
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.3</version>
</dependency>