Précédent   Forum des professionnels en informatique > Logiciels > Solutions d'entreprise > Business Intelligence > BIRT
BIRT Forum d'entraide sur BIRT (Business Intelligence and Reporting Tools). Avant de poster --> FAQ BIRT,Tutoriels BIRT
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 19/04/2007, 21h06   #1
Invité de passage
 
Inscription : avril 2007
Messages : 2
Détails du profil
Informations forums :
Inscription : avril 2007
Messages : 2
Points : 0
Points : 0
Par défaut Problème d'intégration de Birt et Eclipse

Bonjour;
J'ai une préocupation, je n'arrive pas à intégrer mes états générés par Birt dans mon application Eclipse.
Vous avez ci dessous le code et l'erreur générer; Si vous avez une idée, s'il vous plait envoyer la moi.
Merci.

Code :
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//******************
//*****code saisi******
//*****************
import java.util.HashMap;
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.HTMLActionHandler;
import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
import org.eclipse.birt.report.engine.api.HTMLRenderContext;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler;
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;
 
public class executionBirt {
private static Object object;
static void executionBirt() throws EngineException
{
 HashMap<String,Integer> parameters = new HashMap<String,Integer>();
 
 String name = "Top Count";
       Integer pvalue = new Integer(4);
 parameters.put(name, pvalue);
 
 IReportEngine engine=null;
// EngineConfig config = null;
 
 EngineConfig config = new EngineConfig();
 try{
 
  //Configure the Engine and start the Platform
  config = new EngineConfig();
  config.setEngineHome("C:/birtruntime/birt-runtime-2_1_2/ReportEngine");
  //set log config using ( null, Level ) if you do not want a log file
  config.setLogConfig("c:/birt/logs",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){
  ex.printStackTrace();
 }
 
 //Configure the emitter to handle actions and images
 HTMLEmitterConfig emitterConfig = new HTMLEmitterConfig();
 emitterConfig.setActionHandler( new HTMLActionHandler());
 HTMLServerImageHandler imageHandler = new HTMLServerImageHandler();
 emitterConfig.setImageHandler(imageHandler);
 object = config.getEmitterConfigs().put("html",emitterConfig); //$NON-NLS-1$
 
 IReportRunnable design = null;
 
 //Open the report design
 design = engine.openReportDesign("C:/birtruntime/birt-runtime-2_1_2/ReportEngine/samples/hello_world.rptdesign"); 
 
 //Create task to run and render the report,
 IRunAndRenderTask task = engine.createRunAndRenderTask(design); 
 
 //Set Render context to handle url and image locataions
 HTMLRenderContext renderContext = new HTMLRenderContext();
 //Set the Base URL for all actions
 renderContext.setBaseURL("http://localhost/");
 //Tell the Engine to prepend all images with this URL - Note this requires using the HTMLServerImageHandler
 renderContext.setBaseImageURL("http://localhost/myimages");
 //Tell the Engine where to write the images to
 renderContext.setImageDirectory("C:/xampplite/htdocs/myimages");
 //Tell the Engine what image formats are supported.  Note you must have SVG in the string 
 //to render charts in SVG.
 renderContext.setSupportedImageFormats("JPG;PNG;BMP;SVG");
 HashMap<String, HTMLRenderContext> contextMap = new HashMap<String, HTMLRenderContext>();
 contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext);
 task.setAppContext(contextMap );
 //Set parameters for the report
 task.setParameterValues(parameters);
 //Alternatively set each seperately
 //task.setParameterValue("Top Count", new Integer(12));
 task.validateParameters();
 
 //Add a scriptable object, which will allow the report developer to put
 //script in the report that references this Java object. eg in script 
 //pFilter.myjavamethod()
 //ProcessFilter pf = new ProcessFilter();
 //task.addScriptableJavaObject("pFilter", pf);
 
 //Set rendering options - such as file or stream output, 
 //output format, whether it is embeddable, etc
 HTMLRenderOption options = new HTMLRenderOption();
 
 //Remove HTML and Body tags
 //options.setEmbeddable(true);
 
 //Set ouptut location
 options.setOutputFileName("C:/test/2.1/output.html");
 
 //Set output format
 options.setOutputFormat("html");
 task.setRenderOption(options);
 
 //run the report and destroy the engine
 //Note - If the program stays resident do not shutdown the Platform or the Engine
 task.run();
 task.close();
 engine.shutdown();
 Platform.shutdown();
 System.out.println("Finished");
} 
/**
 * @param args
 */
public static void main(String[] args) {
 try
 {
	 executionBirt();
 }
 catch ( Exception e )
 {
  e.printStackTrace();
 }
}
 
}
Citation:
//******************
//*****erreur obtenue******
//*****************
java.lang.NullPointerException
at executionBirt.executionBirt(executionBirt.java:42)
at executionBirt.main(executionBirt.java:118)
java.lang.NullPointerException
at executionBirt.executionBirt(executionBirt.java:59)
at executionBirt.main(executionBirt.java:118)
soupdji est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/04/2007, 11h43   #2
Membre Expert
 
Avatar de moritan
 
Homme
Développeur Java
Inscription : juin 2005
Messages : 659
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 32
Localisation : France, Manche (Basse Normandie)

Informations professionnelles :
Activité : Développeur Java

Informations forums :
Inscription : juin 2005
Messages : 659
Points : 1 052
Points : 1 052
Citation:
Envoyé par soupdji

//******************
//*****erreur obtenue******
//*****************
java.lang.NullPointerException
at executionBirt.executionBirt(executionBirt.java:42)
at executionBirt.main(executionBirt.java:118)
java.lang.NullPointerException
at executionBirt.executionBirt(executionBirt.java:59)
at executionBirt.main(executionBirt.java:118)


Une des objet de ta ligne 42 est null.
Si les ligne que tu connes respecte la mise en page de ta classe c'est celle-ci
Code :
engine = factory.createReportEngine(config);
donc factory ou config est null.
surement factory mais des trace pour vérifier et si c'est bien ça regarde pourquoi ta factory peut-être null
moritan est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 01h43.


 
 
 
 
Partenaires

Hébergement Web