Bonjour,
j'essaye actuellement de générer un rapport au format pdf mais j'ai un problème.
Tout d'abord lorsque lance le rptdesign directement à partir d'eclipse ou d'un serveur JEE ou une appli tourne pour mes rapports je n'ai aucun problème.
Par contre quand je souhaite générer le rapport en pdf ça ne marche pas. J'ai 3 paramètres dans mon rapport qui se nomme
- DateDebut
- TimeOffst
- Categorie
En faite j'ai l'impression que le problème viens de la requête mais je comprend pas l'erreur donc si vous pouvez m'aiguiller .
Le code
Voici ce que j'ai comme erreur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.logging.Level; import org.eclipse.birt.core.framework.Platform; import org.eclipse.birt.report.engine.api.EngineConfig; import org.eclipse.birt.report.engine.api.EngineConstants; import org.eclipse.birt.report.engine.api.EngineException; import org.eclipse.birt.report.engine.api.IRenderOption; import org.eclipse.birt.report.engine.api.IReportEngine; import org.eclipse.birt.report.engine.api.IReportEngineFactory; import org.eclipse.birt.report.engine.api.IReportRunnable; import org.eclipse.birt.report.engine.api.IRunAndRenderTask; import org.eclipse.birt.report.engine.api.RenderOption; public class Edition { public static void main( String[] args ) throws EngineException { EngineConfig config = new EngineConfig(); IReportEngine engine = null; IReportRunnable design = null; try{ config.setEngineHome( "C:\\Documents and Settings\\***\\Mes documents\\Dev\\Programmes\\Runtime BIRT\\4_2_2\\ReportEngine\\" ); config.setLogConfig("C:\\Documents and Settings\\***\\Mes documents\\Dev\\Log\\", Level.FINE); Platform.startup(config); IReportEngineFactory factory = (IReportEngineFactory) Platform .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY ); engine = factory.createReportEngine(config); engine.changeLogLevel( Level.WARNING ); } catch( Exception ex) { System.out.println("catch"); } //Ouverture du rapport design = engine.openReportDesign("Incidents v3.6.rptdesign"); //Création de la tache pour le rendu IRunAndRenderTask task = engine.createRunAndRenderTask(design); //On renseigne les paramètres SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm"); String dateInString = "01/05/15 08:30"; try { task.setParameterValue("DateDebut", formatter.parse(dateInString)); task.setParameterValue("TimeOffst", (new Integer(2))); task.setParameterValue("Categorie", (new String("%"))); task.validateParameters(); } catch (ParseException e) { e.printStackTrace(); } //Set parent classloader for engine task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,Thread.currentThread().getContextClassLoader()); //Save as PDF File IRenderOption options = new RenderOption(); options.setOutputFormat("pdf"); options.setOutputFileName("C:\\Documents and Settings\\***\\Mes documents\\Dev\\Log\\test"); task.setRenderOption(options); //run and render report task.run(); task.close(); System.out.println("FIN"); } }
BIRT Designer Version 4.2.2Exception in thread "main" org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2380)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:191)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at Edition.main(Edition.java:77)
Caused by: java.lang.NoSuchMethodError: org.eclipse.datatools.connectivity.oda.spec.QuerySpecification.getBaseQuery()Lorg/eclipse/datatools/connectivity/oda/spec/BaseQuery;
at org.eclipse.birt.data.engine.executor.DataSourceQuery.prepare(DataSourceQuery.java:284)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.prepareOdiQuery(PreparedOdaDSQuery.java:517)
at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:346)
at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:463)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:178)
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:637)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:152)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:275)
at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1947)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)
... 2 more
Runtime 4.2.2
Base oracle
Merci de vos réponse bonne journée
Partager