NullPointerException when running the ReportEngine() [message #178109] |
Mon, 17 July 2006 16:20 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
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 #178681 is a reply to message #178445] |
Wed, 19 July 2006 09:22 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 #178790 is a reply to message #178689] |
Wed, 19 July 2006 12:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 Go to previous message](theme/Solstice/images/up.png) |
|
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
>>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03421 seconds