Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » NullPointerException when running the ReportEngine()
NullPointerException when running the ReportEngine() [message #178109] Mon, 17 July 2006 16:20 Go to next message
Eclipse UserFriend
Originally posted by: bruno_maya.hotmail.com

Hello,

I have a NullPointerException :

java.lang.NullPointerException
at
org.eclipse.birt.report.engine.extension.internal.ExtensionM anager.loadGenerationExtensionDefns(ExtensionManager.java:26 5)
at
org.eclipse.birt.report.engine.extension.internal.ExtensionM anager. <init>(ExtensionManager.java:79)
at
org.eclipse.birt.report.engine.extension.internal.ExtensionM anager.createInstance(ExtensionManager.java:91)
at
org.eclipse.birt.report.engine.extension.internal.ExtensionM anager.getInstance(ExtensionManager.java:100)
at
org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.<init >(ReportEngineHelper.java:71)
at
org.eclipse.birt.report.engine.api.impl.ReportEngine.<init>(ReportEngine.java:85)
at Report.TestUsingBirt.executeReport(TestUsingBirt.java:31)
at Report.TestUsingBirt.main(TestUsingBirt.java:72)

when running the ReportEngine :

EngineConfig config = new EngineConfig();
config.setEngineHome(
"C:\\birtruntime\\birt-runtime-2_1_0\\ReportEngine" );

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

Does somebody know what I will have forgotten ?

Many thanks,
Bruno
Re: NullPointerException when running the ReportEngine() [message #178166 is a reply to message #178109] Mon, 17 July 2006 19:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This looks like an issue with trying to find the Platform registry.
Can you try something similar to this:


IReportEngine engine=null;

EngineConfig config = null;

try{

config = new EngineConfig( );

config.setEngineHome(
"C:\\birt-runtime-2_1_0\\birt-runtime-2_1_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 ex){

ex.printStackTrace();

}


//Create the report engine

HTMLEmitterConfig emitterConfig = new HTMLEmitterConfig( );

emitterConfig.setActionHandler( new HTMLActionHandler( ) );

HTMLServerImageHandler imageHandler = new HTMLServerImageHandler( );

emitterConfig.setImageHandler( imageHandler );

config.getEmitterConfigs( ).put( "html", emitterConfig ); //$NON-NLS-1$


IReportRunnable design = null;


design =
engine.openReportDesign("C:/test/2.1/chart/InteractiveChart.rptdesign ");


//Create task to run the report - use the task to execute and run the
report,

IRunAndRenderTask task = engine.createRunAndRenderTask(design);

//config.setTempDir("c:/work/test/tmp");


//Set Render context to handle url and image locataions

HTMLRenderContext renderContext = new HTMLRenderContext();

renderContext.setBaseURL("http://localhost/");

renderContext.setBaseImageURL("http://localhost/myimages");

//renderContext.setImageDirectory("myimages");

renderContext.setImageDirectory("C:/xampplite/htdocs/myimages ");

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 );

//task.setParameterValues(parameters);

task.setParameterValue("Top Count", new Integer(12));

task.validateParameters();


//ProcessFilter pf = new ProcessFilter();

//task.addScriptableJavaObject("pFilter", pf);



RenderOptionBase optionsP=new RenderOptionBase();

optionsP.setOutputFormat("html");

optionsP.setOutputFileName("C:/test/2.1/chart/InteractiveChart.html ");




task.setRenderOption(optionsP);



//run the report and destroy the engine

task.run();

task.close();

engine.destroy();

System.out.println("Finished");

Jason

"Bruno Maya" <bruno_maya@hotmail.com> wrote in message
news:3a5fd71537650eda862a7ef49af9877c$1@www.eclipse.org...
> Hello,
>
> I have a NullPointerException :
> java.lang.NullPointerException
> at
> org.eclipse.birt.report.engine.extension.internal.ExtensionM anager.loadGenerationExtensionDefns(ExtensionManager.java:26 5)
> at
> org.eclipse.birt.report.engine.extension.internal.ExtensionM anager. <init>(ExtensionManager.java:79)
> at
> org.eclipse.birt.report.engine.extension.internal.ExtensionM anager.createInstance(ExtensionManager.java:91)
> at
> org.eclipse.birt.report.engine.extension.internal.ExtensionM anager.getInstance(ExtensionManager.java:100)
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.<init >(ReportEngineHelper.java:71)
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngine.<init>(ReportEngine.java:85)
> at Report.TestUsingBirt.executeReport(TestUsingBirt.java:31)
> at Report.TestUsingBirt.main(TestUsingBirt.java:72)
>
> when running the ReportEngine :
>
> EngineConfig config = new EngineConfig();
> config.setEngineHome(
> "C:\\birtruntime\\birt-runtime-2_1_0\\ReportEngine" );
> // Create the report engine
> ReportEngine engine = new ReportEngine( config );
>
> Does somebody know what I will have forgotten ?
>
> Many thanks,
> Bruno
>
>
Re: NullPointerException when running the ReportEngine() [message #178413 is a reply to message #178166] Tue, 18 July 2006 13:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bruno_maya.hotmail.com

It is the same. There is the NullPointerException on this line :
engine = factory.createReportEngine(config);

Regards, Bruno
Re: NullPointerException when running the ReportEngine() [message #178437 is a reply to message #178413] Tue, 18 July 2006 13:48 Go to previous messageGo to next message
orkus9 is currently offline orkus9Friend
Messages: 214
Registered: July 2009
Senior Member
Maybe the factory is null :-)

Bruno Maya schrieb:
> It is the same. There is the NullPointerException on this line :
> engine = factory.createReportEngine(config);
>
> Regards, Bruno
>
Re: NullPointerException when running the ReportEngine() [message #178445 is a reply to message #178437] Tue, 18 July 2006 14:57 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Take the example I posted last,
modify the birt home and run it,
Post the stack trace once more.

Jason

"Orkus" <orkus9@web.de> wrote in message
news:e9ionb$n81$2@utils.eclipse.org...
> Maybe the factory is null :-)
>
> Bruno Maya schrieb:
>> It is the same. There is the NullPointerException on this line :
>> engine = factory.createReportEngine(config);
>>
>> Regards, Bruno
>>
Re: NullPointerException when running the ReportEngine() [message #178681 is a reply to message #178445] Wed, 19 July 2006 09:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bruno_maya.hotmail.com

Orkus is right... The factory was null !
Jason, the Birt home was already modified with my own path. But I saw the
factory was null because the class defined inside this static :
IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY
is not present.
The value of this static is :
org.eclipse.birt.report.engine.ReportEngineFactory
I did not find this class in the org.eclipse.birt.report.engine.engine
package.
May be I do not have a good release of a jar file ?
Nevertheless I downloaded the full Eclipse installation
(birt-report-designer-all-in-one-2_1_0.zip)

Regards,
Bruno
Re: NullPointerException when running the ReportEngine() [message #178689 is a reply to message #178681] Wed, 19 July 2006 09:42 Go to previous messageGo to next message
orkus9 is currently offline orkus9Friend
Messages: 214
Registered: July 2009
Senior Member
Sorry, but in dont understand.

IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY is of the type
String. Its a static constant.


org.eclipse.birt.report.engine.engine !?!?
org.eclipse.birt.report.engine.api would be correct.
I guess, that you use the wrong jars.
Use the jars, which are in the lib folder (e.g. engineapi.jar,
chartengineapi.jar ....). Dont use the jars, which are in the
plugins folder.

Best regards,

Orkus


Bruno Maya schrieb:
> Orkus is right... The factory was null !
> Jason, the Birt home was already modified with my own path. But I saw
> the factory was null because the class defined inside this static :
> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY
> is not present.
> The value of this static is :
> org.eclipse.birt.report.engine.ReportEngineFactory
> I did not find this class in the org.eclipse.birt.report.engine.engine
> package.
> May be I do not have a good release of a jar file ?
> Nevertheless I downloaded the full Eclipse installation
> (birt-report-designer-all-in-one-2_1_0.zip)
>
> Regards, Bruno
>
Re: NullPointerException when running the ReportEngine() [message #178790 is a reply to message #178689] Wed, 19 July 2006 12:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bruno_maya.hotmail.com

Hi Orkus,

It was the source that Jason told me to try :

IReportEngine engine=null;
EngineConfig config = null;
try{
config = new EngineConfig( );

config.setEngineHome("C:\\birtruntime\\birt-runtime-2_1_0\\ReportEngine ");
config.setLogConfig(null, Level.FINE);

Platform.startup( config );
// IReportEngineFactory factory = (IReportEngineFactory)
Platform.createFactoryObject(
//
"org.eclipse.birt.report.engine.api.impl.ReportEngineFactory " );
IReportEngineFactory factory = (IReportEngineFactory)
Platform.createFactoryObject(
IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
engine.changeLogLevel( Level.WARNING );
}catch( Exception ex){
System.out.println("erreur");
ex.printStackTrace();
}

And the static constant
IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY =
"org.eclipse.birt.report.engine.ReportEngineFactory"

Also I tried to instanciate the factory like this but I had also a null
result :
IReportEngineFactory factory = (IReportEngineFactory)
Platform.createFactoryObject(
"org.eclipse.birt.report.engine.api.impl.ReportEngineFactory " );

Thanks, Bruno


Orkus wrote:

> Sorry, but in dont understand.

> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY is of the type
> String. Its a static constant.


> org.eclipse.birt.report.engine.engine !?!?
> org.eclipse.birt.report.engine.api would be correct.
> I guess, that you use the wrong jars.
> Use the jars, which are in the lib folder (e.g. engineapi.jar,
> chartengineapi.jar ....). Dont use the jars, which are in the
> plugins folder.

> Best regards,

> Orkus


> Bruno Maya schrieb:
>> Orkus is right... The factory was null !
>> Jason, the Birt home was already modified with my own path. But I saw
>> the factory was null because the class defined inside this static :
>> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY
>> is not present.
>> The value of this static is :
>> org.eclipse.birt.report.engine.ReportEngineFactory
>> I did not find this class in the org.eclipse.birt.report.engine.engine
>> package.
>> May be I do not have a good release of a jar file ?
>> Nevertheless I downloaded the full Eclipse installation
>> (birt-report-designer-all-in-one-2_1_0.zip)
>>
>> Regards, Bruno
>>
Re: NullPointerException when running the ReportEngine() [message #178848 is a reply to message #178790] Wed, 19 July 2006 14:25 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Verify that you have downloaded the Report Engine, which is a seperate
download from the
designer.

See:
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.p hp

Jason

"Bruno Maya" <bruno_maya@hotmail.com> wrote in message
news:c155d218ef05b805b563c92aef1b1bc4$1@www.eclipse.org...
> Hi Orkus,
>
> It was the source that Jason told me to try :
>
> IReportEngine engine=null;
> EngineConfig config = null;
> try{
> config = new EngineConfig( );
>
> config.setEngineHome("C:\\birtruntime\\birt-runtime-2_1_0\\ReportEngine ");
> config.setLogConfig(null, Level.FINE);
>
> Platform.startup( config );
> // IReportEngineFactory factory = (IReportEngineFactory)
> Platform.createFactoryObject( //
> "org.eclipse.birt.report.engine.api.impl.ReportEngineFactory " );
> IReportEngineFactory factory = (IReportEngineFactory)
> Platform.createFactoryObject(
> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
> engine = factory.createReportEngine( config );
> engine.changeLogLevel( Level.WARNING );
> }catch( Exception ex){
> System.out.println("erreur");
> ex.printStackTrace();
> }
>
> And the static constant
> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY =
> "org.eclipse.birt.report.engine.ReportEngineFactory"
>
> Also I tried to instanciate the factory like this but I had also a null
> result :
> IReportEngineFactory factory = (IReportEngineFactory)
> Platform.createFactoryObject(
> "org.eclipse.birt.report.engine.api.impl.ReportEngineFactory " );
>
> Thanks, Bruno
>
>
> Orkus wrote:
>
>> Sorry, but in dont understand.
>
>> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY is of the type
>> String. Its a static constant.
>
>
>> org.eclipse.birt.report.engine.engine !?!?
>> org.eclipse.birt.report.engine.api would be correct.
>> I guess, that you use the wrong jars.
>> Use the jars, which are in the lib folder (e.g. engineapi.jar,
>> chartengineapi.jar ....). Dont use the jars, which are in the
>> plugins folder.
>
>> Best regards,
>
>> Orkus
>
>
>> Bruno Maya schrieb:
>>> Orkus is right... The factory was null !
>>> Jason, the Birt home was already modified with my own path. But I saw
>>> the factory was null because the class defined inside this static :
>>> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY
>>> is not present.
>>> The value of this static is :
>>> org.eclipse.birt.report.engine.ReportEngineFactory
>>> I did not find this class in the org.eclipse.birt.report.engine.engine
>>> package.
>>> May be I do not have a good release of a jar file ?
>>> Nevertheless I downloaded the full Eclipse installation
>>> (birt-report-designer-all-in-one-2_1_0.zip)
>>>
>>> Regards, Bruno
>>>
>
>
Previous Topic:Chart doesn't display in browser
Next Topic:Problems with the Design Engine
Goto Forum:
  


Current Time: Thu Aug 29 23:29:42 GMT 2024

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

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

Back to the top