Problème de génération rapport BIRT!

CHABHOC1 - 11 sept. 2012 à 19:09
cs_Julien39 Messages postés 6414 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 29 juillet 2020 - 11 sept. 2012 à 20:13
Bonjour;
j'ai lit quels-que guides et tutos a propos birt notamment (Birt 3.7 Migration Guide - Eclipsepedia)et
(Report Engine API),et je vois des problèmes dans plusieur forums,mais les solutions n’arrivent pas a résoudre mon problème:
voila mon code:

import java.sql.Connection;
import java.util.logging.Level;
import javax.swing.JOptionPane;

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.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunTask;

public class exemplebirt {
public static Connection conect;
public static IReportEngine engine ;

static void excecuteReport() throws EngineException{

try {
EngineConfig config = new EngineConfig( );
//config.setEngineHome("D:/birt-runtime-4_2_0/ReportEngine/");
config.setLogConfig(null, 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 e) {
JOptionPane.showMessageDialog(null, e.getMessage(),"Error",JOptionPane.ERROR_MESSAGE);
}

//Open the report design
try {

IReportRunnable design = engine.openReportDesign("D:/birt-runtime-4_2_0/ReportEngine/samples/hello_world.rptdesign");

//Create task to run the report - use the task to execute the report and save to disk.
IRunTask task = engine.createRunTask(design);
//Set parent classloader for engine
task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, exemplebirt.class.getClassLoader());

//run the report and destroy the engine
task.run("D:/birt-runtime-4_2_0/ReportEngine/samples/hello_world.rptdesign");

task.close();

}
catch (EngineException e1) {
System.out.println("[Lecture de l'état BIRT]........FAILED" + e1.getMessage());
}

System.out.println("[Lecture de l'état BIRT]................OK");
engine.destroy();
Platform.shutdown();
System.out.println("Fini...");

}

public static void main(String[] arg){
exemplebirt h=new exemplebirt();

try {
exemplebirt.excecuteReport();
} catch (EngineException e) {
// TODO Auto-generated catch block

}


}
}


avec les erreurs suivant:


Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/CoreException
at org.eclipse.birt.core.framework.Platform.createPlatformLauncher(Platform.java:115)
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:74)
at hhh.excecuteReport(hhh.java:31)
at hhh.main(hhh.java:74)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.CoreException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more

je crois que le probleme est dans (Platform.startup( config );)

sachant que je télécharger Birt-runtime-4_2_0 et je l'extraire ds D:\ avec configuration des CLASSPATH comme ce-ci:
1-D:/Birt-runtime-4_2_0/reportEngine/lib
2-<mon instalation eclipse>/plugins/org/eclipse/birt/cor-3.8.0...etc.
mais pas de solution!
qu’un qui peut m'aider et me fournir des nouveau références et tutos.
merci.

1 réponse

cs_Julien39 Messages postés 6414 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 29 juillet 2020 371
11 sept. 2012 à 20:13
Salut,

C'est effectivement un problème d'import de .jar.

Ajoutes le plutot dans ton classpath, tu utilises quel ide ?
0
Rejoignez-nous