Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[birt-dev] Birt report to call in a jsp

Hi
 I am a newbie  to Birt
I used  the latest rc5 which is intergrated  with eclipse
The report  designer works perfects and i can preview  my report.
I found it difficult to find  some working code  to call the report(which is query driven)

Hope some one can give me  a  hand
 thankx

The code i tried was this,

package com.GreenLight.Birt;

import java.util.HashMap;

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.HTMLRenderContext;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.ReportEngine;

public class ReportExecutor {
        public static void main(String[] args)
        {
                 EngineConfig config = new EngineConfig();
                  config.setEngineHome( "C://birtwork//ReportEngine" );
                 // config.setLogConfig("c:\\temp\\birtlog", java.util.logging.Level.ALL);
                  // Create the report engine
                  ReportEngine engine = new ReportEngine( config );
                
                  //Open a report design - use design to modify design, retrieve embedded images etc.
                  IReportRunnable design;
                  try {
                   design = engine.openReportDesign("C://birtwork//BirtReports//reports//test.rptdesign");
                  } catch (EngineException e) {
                   engine.destroy();
                   return;
                  }
                
                  //Create task to run the report - use the task to execute and run the report,
                  IRunAndRenderTask task = engine.createRunAndRenderTask(design);
                
                  //Set Render context to handle url and image locataions
                  HTMLRenderContext renderContext = new HTMLRenderContext();
                
                
                
                  //Set rendering options - such as file or stream output,
                  //output format, whether it is embeddable, etc
                  HTMLRenderOption options = new HTMLRenderOption();
//                  options.setOutputStream(arg1.getOutputStream());
                  options.setOutputFileName("c:\\temp\\report.html");
                  options.setOutputFormat("html");
//                  options.setEmbeddable(true);
                  task.setRenderOption(options);
                
                  try {
                   //run the report and destroy the engine
                   task.run();
                  } catch (EngineException e1) {
                  }
                
                  engine.destroy();
//                  arg1.getWriter().println("help, I am stuck in this servlet");
                


        }

}


and  i got an error like
/**************************************************************/
Exception in thread "main" java.lang.NoSuchMethodError: org.eclipse.emf.common.util.AbstractEnumerator.<init>(ILjava/lang/String;Ljava/lang/String;)V
    at org.eclipse.birt.chart.model.attribute.Position.<init>(Position.java:285)
    at org.eclipse.birt.chart.model.attribute.Position.<clinit>(Position.java:114)
    at org.eclipse.birt.chart.reportitem.ChartReportItemImpl.<clinit>(ChartReportItemImpl.java:78)
    at org.eclipse.birt.chart.reportitem.ChartReportItemFactoryImpl.newReportItem(ChartReportItemFactoryImpl.java:47)
    at org.eclipse.birt.report.model.extension.PeerExtensibilityProvider.initializeReportItem(PeerExtensibilityProvider.java:384)
    at org.eclipse.birt.report.model.elements.ExtendedItem.initializeReportItem(ExtendedItem.java:293)
    at org.eclipse.birt.report.model.api.validators.ExtensionValidator.doValidate(ExtensionValidator.java:95)
    at org.eclipse.birt.report.model.api.validators.ExtensionValidator.validate(ExtensionValidator.java:76)
    at org.eclipse.birt.report.model.validators.ValidationNode.perform(ValidationNode.java:133)
   


Can you pls help to guide me /get some working  code


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.

Back to the top