我的JasperReports的報告執行好,當我預覽它裏面的iReport 5.1.0。它包含一個餅圖,當我需要從jsp文件運行它時出現問題。無法初始化類net.sf.jasperreports.charts.type.PlotOrientationEnum
的錯誤信息是:
java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.charts.type.PlotOrientationEnum
我的env是:WIN 7 - JDK7 - NetBean 8。
使用的庫:
- 燒烤-1.5-beta1.jar
- 公地的BeanUtils-1.8.2.jar
- 公地集合-3.2.1.jar
- 公共沼氣池-2.1.jar
- 公地javaflow-20060411.jar
- 共享記錄-1.1.jar
- 的iText-2.1。 7.js2_111.jar
- JasperReports的-5.1.0.jar
- 的JasperReports的擴展-3.5.3.jar
- 的JasperReports的字體-5.0.4.jar
- jcommon,1.0.15.jar
- jfreechart的-1.0.12.jar
- ojdbc6.jar
- 的spring.jar
這裏是一個完整的錯誤消息:
java.lang.NoClassDefFoundError: org/jfree/chart/plot/PlotOrientation
at net.sf.jasperreports.charts.type.PlotOrientationEnum.<clinit>(PlotOrientationEnum.java:42)
at net.sf.jasperreports.engine.base.JRBaseChartPlot.<init>(JRBaseChartPlot.java:76)
at net.sf.jasperreports.charts.base.JRBasePiePlot.<init>(JRBasePiePlot.java:71)
at net.sf.jasperreports.charts.design.JRDesignPiePlot.<init>(JRDesignPiePlot.java:52)
at net.sf.jasperreports.engine.design.JRDesignChart.setChartType(JRDesignChart.java:744)
at net.sf.jasperreports.engine.design.JRDesignChart.<init>(JRDesignChart.java:189)
at net.sf.jasperreports.charts.xml.JRPieChartFactory.createObject(JRPieChartFactory.java:47)
at org.apache.commons.digester.FactoryCreateRule.begin(FactoryCreateRule.java:397)
at org.apache.commons.digester.Digester.startElement(Digester.java:1583)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:749)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2768)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:846)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:775)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:628)
at org.apache.commons.digester.Digester.parse(Digester.java:1892)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:230)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:218)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:171)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:448)
at logic.PDFReport.printReport(PDFReport.java:93)
at org.apache.jsp.Reports_jsp._jspService(Reports_jsp.java:178)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: org.jfree.chart.plot.PlotOrientation
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 64 more
是這些文件的WEB-INF/lib目錄中複製呢? – Satya 2014-09-28 02:36:00
不完全是,因爲我從java對象方法調用jasper報告,而jsp只是調用這個方法,但是它複製到D:\ myproject \ build \ web \ WEB-INF \ classes \ mypackage \ myjars。 – 2014-09-28 16:20:16
@Mohammedashraf你應該發佈完整的堆棧跟蹤 – 2014-09-29 05:50:55