在Eclipse NoClassDefFoundError中使用Jasper-Report的问题

时间:2015-03-06 09:08:29

标签: java eclipse jasper-reports pdf-generation noclassdeffounderror

所以当我想在Eclipse-App中使用Jasper-Reports时遇到问题。 当我想写一个PDF时,我总是会收到以下错误。

WARNUNG: Found two components for namespace http://jasperreports.sourceforge.net/jasperreports/components
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
    Source text : $F{globalAngaben}.getPruefberichtnr()
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:263)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:611)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:579)
    at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1016)
    at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:504)
    at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:488)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:354)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:290)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:152)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:892)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:114)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:668)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:649)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:971)
    at com.systech.GerentForm.handlers.PDFHandler.createPDF(PDFHandler.java:97)
    at com.systech.GerentForm.handlers.PDFHandler.execute(PDFHandler.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850)
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743)
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727)
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3742)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3363)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:162)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.NoClassDefFoundError: com/systech/ge/client/dao/GlobalAngaben
    at Gerentform_A4_1425317359080_722125.evaluate(Gerentform_A4_1425317359080_722125:215)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250)
    ... 56 more 

在我的应用程序中,该类确实存在,我可以使用它。 Jaspersoft Studio编译我的jasper文件没有问题。 当我想在Studio中进行预览时,会出现以下错误:

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
    Source text : $F{globalAngaben}.getPruefberichtnr()
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:466)
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:441)
    at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:333)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
    Source text : $F{globalAngaben}.getPruefberichtnr()
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:263)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:611)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:579)
    at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1016)
    at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:504)
    at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:488)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:354)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:290)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:152)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963)
    at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: com.systech.ge.client.dao.GlobalAngaben cannot be cast to com.systech.ge.client.dao.GlobalAngaben
    at Gerentform_A4_1425317364309_973729.evaluate(Gerentform_A4_1425317364309_973729:215)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250)
    ... 13 more 
到目前为止,还没有找到解决方案。 也许有人在这里有线索。

到目前为止。

编辑:

JRBeanCollectionDataSource jrbcds = new JRBeanCollectionDataSource( Arrays.asList( fsureport ) );

JasperPrint jasperPrint;
Map< String, Object > parameter = new HashMap< String, Object >();

jasperPrint = JasperFillManager.fillReport( in, parameter, jrbcds );

它崩溃了@fillReport()。

0 个答案:

没有答案