我有一个页面,我将一些数据加载到数据表中,并提供三个按钮,用于导出到pdf,xls和csv。我使用了Primefaces在其网页中使用的相同示例代码:
<h:commandLink>
<p:graphicImage value="../resources/images/Excel.png" />
<p:dataExporter type="xls" target="grdAudit" fileName="ApplicationLog" />
</h:commandLink>
当我单击commandLink时,出现以下异常错误:
java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException
at org.primefaces.component.export.PDFExporter.export(PDFExporter.java:45)
at org.primefaces.component.export.DataExporter.processAction(DataExporter.java:94)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:84)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773)
at javax.faces.component.UICommand.broadcast(UICommand.java:296)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:783)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1248)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute
(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet
(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter
(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun
(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run
(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs
(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute
(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute
(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.ClassNotFoundException: com.lowagie.text.DocumentException
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass
(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass
(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass
(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at weblogic.utils.classloaders.GenericClassLoader.loadClass
(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass
(ChangeAwareClassLoader.java:43)
... 29 more
显然,这个类缺失:com.lowagie.text.DocumentException但我不知道如何获取它,在哪里安装它以及错误出现的原因。有什么想法吗?
答案 0 :(得分:1)
首先,用户的primefaces 2.2.1指南在第12页上说,您需要特定版本的POI和iText库用于导出。下载了正确的版本并将它们包含在项目中后,导出应该可以正常工作。
答案 1 :(得分:1)
下载并在项目中导入它,它将解决您的错误。