Skip to main content



      Home
Home » Archived » BIRT » Can't startup the OSGI framework
Can't startup the OSGI framework [message #251403] Tue, 07 August 2007 02:20 Go to next message
Eclipse UserFriend
Originally posted by: sjaheer.gmail.com

Hi,

I am trying to run a report from the stand alone java class, and am
getting the following exceptions.


debug : 1
debug : 2
debug : 3
debug : 4
debug : 5
debug : 6
org.eclipse.birt.core.exception.BirtException: Can't startup the OSGI
framework
at org.eclipse.birt.core.framework.Platform.startup(Platform.ja va:89)
at
org.eclipse.birt.report.engine.api.ReportEngine.<init>(ReportEngine.java:54)
at com.alshaya.ares.em.report.FireReport1.<init>(FireReport1.java:76)
at com.alshaya.ares.em.report.FireReport1.main(FireReport1.java :159)
Caused by: org.eclipse.birt.core.exception.BirtException: Could not find
the Framework - {0}
at
org.eclipse.birt.core.framework.osgi.OSGILauncher.startup(OS GILauncher.java:95)
at org.eclipse.birt.core.framework.Platform.startup(Platform.ja va:77)
... 3 more
Can't load the report engine
debug : 7
debug : 8
Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.birt.report.engine.api.ReportEngine.openReportDe sign(ReportEngine.java:121)


following is my java class
----------------------

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.logging.Level;

import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.IPlatformContext;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.core.framework.PlatformFileContext;
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.HTMLCompleteImageHandler;
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.IGetParameterDefinitionTa sk;
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.PDFRenderContext;
import org.eclipse.birt.report.engine.api.RenderOptionBase;
import org.eclipse.birt.report.engine.api.ReportEngine;

public class FireReport1
{
public FireReport1()
{
// Create an EngineConfig object.
EngineConfig config = new EngineConfig( );

System.out.println("debug : 1");

// Set up the path to your engine home directory.
config.setEngineHome(
"D:/birtruntime/birt-runtime-2_2_0/ReportEngine" );

System.out.println("debug : 2");

try
{
Platform.startup(config);
}
catch (BirtException e2)
{
// TODO Auto-generated catch block
System.out.println("here 1: "+e2.getMessage());
}

System.out.println("debug : 3");

// Explicitly set up the stand-alone application
IPlatformContext context = new PlatformFileContext( );

config.setEngineContext( context );

System.out.println("debug : 4");

// set log config using ( null, Level ) if you do not want a
log file
//config.setLogConfig(path+"logfiles", Level.FINE);

// Set up writing images or charts embedded in HTML output.
HTMLCompleteImageHandler imageHandler = new
HTMLCompleteImageHandler( );
HTMLEmitterConfig hc = new HTMLEmitterConfig( );
hc.setImageHandler( imageHandler );

System.out.println("debug : 5");

config.setEmitterConfiguration(
RenderOptionBase.OUTPUT_FORMAT_HTML, hc );

System.out.println("debug : 6");

// Create the engine.
ReportEngine engine = new ReportEngine( config );

System.out.println("debug : 7");

String designName = "D:/BirtJavaReport/hideRows.rptdesign";
IReportRunnable runnable = null;

System.out.println("debug : 8");

try
{
runnable = engine.openReportDesign( designName );
}
catch ( EngineException e )
{
System.err.println( "Design " + designName + " not found!" );
engine.shutdown( );
System.exit( -1 );
}

System.out.println("debug : 9");
// Get the value of a simple property.
String author = ( String ) runnable.getProperty(
IReportRunnable.AUTHOR );

System.out.println("debug : 10");

/* Configuring properties on an IRunAndRenderTask object */
// Create a run and render task object.


IRunAndRenderTask task = engine.createRunAndRenderTask(
runnable );

System.out.println("debug : 11");

HTMLRenderOption options = new HTMLRenderOption( );
String output = "D:/BirtJavaReport/html/hideRows.html";
options.setOutputFileName( "hideRows.html" );

System.out.println("debug : 12");

// Apply the rendering options to the task.
task.setRenderOption( options );

System.out.println("debug : 13");

// Instantiate an HTML rendering context object and
// set the name of the directory for images.
HTMLRenderContext renderContext = new HTMLRenderContext( );
renderContext.setImageDirectory("path+image");

System.out.println("debug : 14");

// Apply the rendering context to the task.
HashMap appContext = new HashMap( );
appContext.put(
EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );

System.out.println("debug : 15");

task.setAppContext( appContext );

System.out.println("debug : 16");

/* Generating a report from a report design or a report
document */

try
{
task.run( );
System.out.println( "Created Report " + output);
}
catch ( EngineException e1 )
{
System.err.println( "Report " + output + " run failed." );
System.err.println("here 2: "+ e1.toString( ) );
}
System.out.println("debug : 17");

engine.shutdown( );

System.out.println("debug : end");
}

public static void main(String args[])
{
new FireReport1();
}
}


can anybody pl help to run the report from the stand alone java class

Thanks for all in advance
java.lang.NullPointerException while running the report from standalonjava class [message #251416 is a reply to message #251403] Tue, 07 August 2007 04:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sjaheer.gmail.com

Hi,

i just modified my java code and moved one step ahead but still am getting
the following exceptions


following is my java classs code
----------------------------------

java.lang.NullPointerException
at com.alshaya.ares.em.report.TestClass.<init>(TestClass.java:44)
at com.alshaya.ares.em.report.TestClass.main(TestClass.java:81)
java.lang.NullPointerException
at com.alshaya.ares.em.report.TestClass.<init>(TestClass.java:54)
at com.alshaya.ares.em.report.TestClass.main(TestClass.java:81)


import java.util.logging.Level;

import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
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;

public class FireReport
{
public FireReport()
{
try
{
// Create an EngineConfig object.
EngineConfig config = new EngineConfig( );

// Set up the path to your engine home directory.
config.setEngineHome( "D:/birtruntime/birt-runtime-2_2_0/ReportEngine" );

// set log config using ( null, Level ) if you do not want a log file
config.setLogConfig("D:/BirtJavaReport/logfiles", Level.FINE);

try
{
Platform.startup(config);
}
catch (BirtException e2)
{
// TODO Auto-generated catch block
System.out.println("here 1: "+e2.getMessage());
}
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(
IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );

IReportEngine engine = null;
try
{
engine = factory.createReportEngine( config );
engine.changeLogLevel( Level.WARNING );
}
catch(Exception exep)
{
System.out.println("here 2 :");
exep.printStackTrace();
}

//Open a report design - use design to modify design, retrieve embedded
images etc.
IReportRunnable design =
engine.openReportDesign("D:/BirtJavaReport/hideRows.rptdesign ");

//Create task to run the report and render the report
IRunAndRenderTask task = engine.createRunAndRenderTask(design);

//Set rendering options - such as file or stream output,
//output format, whether it is embeddable, etc
HTMLRenderOption options = new HTMLRenderOption();
//options.setOutputStream(System.out);
options.setOutputFileName("D:/BirtJavaReport/html/hideRows.html ");
options.setOutputFormat("html");
task.setRenderOption(options);

task.run();

engine.destroy();
Platform.shutdown();
System.out.println("Finished");
}
catch(Exception exe)
{
System.out.println("Here 3 : ");
exe.printStackTrace();
}
}
public static void main(String args[])
{
new FireReport();
}
}
Re: java.lang.NullPointerException while running the report from standalonjava class [message #251507 is a reply to message #251416] Tue, 07 August 2007 12:12 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Shaik,

What line are you getting the exception on?

Jason

shaik wrote:
> Hi,
>
> i just modified my java code and moved one step ahead but still am
> getting the following exceptions
>
>
> following is my java classs code
> ----------------------------------
>
> java.lang.NullPointerException
> at com.alshaya.ares.em.report.TestClass.<init>(TestClass.java:44)
> at com.alshaya.ares.em.report.TestClass.main(TestClass.java:81)
> java.lang.NullPointerException
> at com.alshaya.ares.em.report.TestClass.<init>(TestClass.java:54)
> at com.alshaya.ares.em.report.TestClass.main(TestClass.java:81)
>
>
> import java.util.logging.Level;
>
> import org.eclipse.birt.core.exception.BirtException;
> import org.eclipse.birt.core.framework.Platform;
> import org.eclipse.birt.report.engine.api.EngineConfig;
> 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;
>
> public class FireReport
> {
> public FireReport()
> {
> try
> {
> // Create an EngineConfig object.
> EngineConfig config = new EngineConfig( );
>
> // Set up the path to your engine home directory.
> config.setEngineHome(
> "D:/birtruntime/birt-runtime-2_2_0/ReportEngine" );
>
> // set log config using ( null, Level ) if you do not want a log
> file
> config.setLogConfig("D:/BirtJavaReport/logfiles", Level.FINE);
> try
> {
> Platform.startup(config);
> } catch (BirtException e2) {
> // TODO Auto-generated catch block
> System.out.println("here 1: "+e2.getMessage());
> }
> IReportEngineFactory factory = (IReportEngineFactory) Platform
> .createFactoryObject(
> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
> IReportEngine engine = null;
> try
> {
> engine = factory.createReportEngine( config );
> engine.changeLogLevel( Level.WARNING );
> }
> catch(Exception exep)
> {
> System.out.println("here 2 :");
> exep.printStackTrace();
> }
>
> //Open a report design - use design to modify design, retrieve
> embedded images etc. IReportRunnable design =
> engine.openReportDesign("D:/BirtJavaReport/hideRows.rptdesign ");
>
> //Create task to run the report and render the report
> IRunAndRenderTask task = engine.createRunAndRenderTask(design);
>
> //Set rendering options - such as file or stream output,
> //output format, whether it is embeddable, etc
> HTMLRenderOption options = new HTMLRenderOption();
> //options.setOutputStream(System.out);
> options.setOutputFileName("D:/BirtJavaReport/html/hideRows.html ");
> options.setOutputFormat("html");
> task.setRenderOption(options);
>
> task.run();
>
> engine.destroy();
> Platform.shutdown();
> System.out.println("Finished"); }
> catch(Exception exe)
> {
> System.out.println("Here 3 : ");
> exe.printStackTrace();
> }
> }
> public static void main(String args[])
> {
> new FireReport();
> }
> }
>
>
Previous Topic:How to display the contents of the previous row in the report?
Next Topic:BIRT Integration with PDE...
Goto Forum:
  


Current Time: Fri May 09 08:41:39 EDT 2025

Powered by FUDForum. Page generated in 0.03646 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top