|
|
|
Re: BIRT basics [message #786663 is a reply to message #786461] |
Mon, 30 January 2012 17:28 |
|
Do you have the birt runtime libs in your classpath/buildpath?
Remove this line:
config.setEngineHome(
"C:/birt-runtime-3_7_1/birt-runtime-3_7_1/ReportEngine" );
Jason
On 1/30/2012 8:10 AM, Guru Prasad wrote:
> I have written some java code to generate report using Birt libraries
>
> package com.report.test;
>
> 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.EngineException;
> import org.eclipse.birt.report.engine.api.HTMLRenderContext;
> import org.eclipse.birt.report.engine.api.HTMLRenderOption;
> 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.IRunTask;
>
> public class RunTask {
>
> public static void main( String[] args )
> {
>
> EngineConfig config = null;
> IReportEngine engine = null;
> IRunTask task = null;
> //Open a report design
> try{
> config = new EngineConfig( );
> //delete the following line if using BIRT 3.7 or later
> config.setEngineHome( "C:/birt-runtime-3_7_1/birt-runtime-3_7_1/ReportEngine" );
> config.setLogConfig("C:/birt-runtime-3_7_1", Level.FINE);
>
> Platform.startup( config ); //If using RE API in Eclipse/RCP application this is not needed.
> IReportEngineFactory factory = (IReportEngineFactory) Platform
> .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
> engine = factory.createReportEngine( config );
> engine.changeLogLevel( Level.WARNING );
>
>
> IReportRunnable design = engine.openReportDesign("C:/birt-runtime-3_7_1/birt-runtime-3_7_1/ReportEngine/samples/hello_world.rptdesign");
> //Create task to run the report - use the task to execute the report and save to disk.
> task = engine.createRunTask(design);
>
> //Set parent classloader for engine
> //task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, RunTaskExample.class.getClassLoader());
>
> //run the report and destroy the engine
> task.run("C:/birt-runtime-3_7_1/birt-runtime-3_7_1/ReportEngine/samples/hello_world.rptdesign");
>
> task.close();
> engine.destroy();
> Platform.shutdown();
>
> }catch( Exception ex){
> ex.printStackTrace();
> }
>
> }
> }
>
>
> if I run this ,
> org.eclipse.birt.core.exception.BirtException: error.CannotStartupOSGIPlatform
> at org.eclipse.birt.core.framework.Platform.startup(Platform.java:81)
> at com.report.test.RunTask.main(RunTask.java:32)
> Caused by: java.lang.SecurityException: class "org.eclipse.core.runtime.IAdapterManager"'s signer information does not match signer information of other classes in the same package
> at java.lang.ClassLoader.checkCerts(Unknown Source)
> at java.lang.ClassLoader.preDefineClass(Unknown Source)
> at java.lang.ClassLoader.defineClassCond(Unknown Source)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> at java.security.SecureClassLoader.defineClass(Unknown Source)
> at java.net.URLClassLoader.defineClass(Unknown Source)
> at java.net.URLClassLoader.access$000(Unknown Source)
> 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)
> at org.eclipse.birt.core.framework.jar.ServiceLauncher.startup(ServiceLauncher.java:45)
> at org.eclipse.birt.core.framework.Platform.startup(Platform.java:75)
> ... 1 more
>
>
> Please find attachment for libraries i'm using.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03619 seconds