Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Error in an application integrating report engine
Error in an application integrating report engine [message #653650] Thu, 10 February 2011 14:30 Go to next message
Stephane Coquard is currently offline Stephane CoquardFriend
Messages: 8
Registered: February 2011
Junior Member
Hi all,
I am currently integrating the report engine into a client/server application. The engine is on the server side and is due to send reports as byte arrays towards the client which will open them.
Using Maven, I uploaded the Birt libraries onto the maven repository and set the BIRT_HOME to a location on my machine for test purpose which is obviously different from the maven repo.
The app compiles, but when launching the report, an exception occurs at the engine.openReportDesign("") level. The thing is that when launching the report with the same BIRT_HOME and the ReportEngine in the classpath (thus no maven) from a simple project, the report is generated.
I sense that this is a version problem, but I don't know where to look. Some insight would be most welcome.

Thanks!

the code that launches the report:
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
    EngineConfig config = new EngineConfig();
    config.setBIRTHome("C:\\Documents and Settings\\sco\\Bureau\\birtruntime\\ReportEngine");
    Platform.startup(config);
    IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
    IReportEngine engine = factory.createReportEngine(config);
    IReportRunnable design = engine.openReportDesign("C:\\Documents and Settings\\sco\\Bureau\\birtruntime\\ReportEngine\\samples\\customers.rptdesign");
    IRunAndRenderTask task = engine.createRunAndRenderTask(design);
    task.setParameterValue("languageParameter", language);
    PDFRenderOption options = new PDFRenderOption();
    options.setOutputStream(bos);
    options.setOutputFormat("pdf");
    task.setRenderOption(options);
    task.run();
    task.close();
    engine.destroy();
    Platform.shutdown();
} catch(Exception e) {
    e.printStackTrace();
}
return bos.toByteArray();


And the exception:
10 févr. 2011 11:22:24 org.eclipse.birt.report.model.metadata.MetaDataReader read
GRAVE: null
java.lang.NullPointerException
        at org.eclipse.birt.report.model.core.DesignElement.initSlots(DesignElement.java:2990)
        at org.eclipse.birt.report.model.elements.ReportDesignImpl.<init>(ReportDesignImpl.java:82)
        at org.eclipse.birt.report.model.elements.ReportDesign.<init>(ReportDesign.java:52)
        at org.eclipse.birt.report.model.parser.DesignParserHandler.<init>(DesignParserHandler.java:49)
        at org.eclipse.birt.report.model.parser.DesignReader.read(DesignReader.java:86)
        at org.eclipse.birt.report.model.core.DesignSessionImpl.openDesign(DesignSessionImpl.java:315)
        at org.eclipse.birt.report.model.api.SessionHandleImpl.openDesign(SessionHandleImpl.java:294)
        at org.eclipse.birt.report.engine.parser.ReportParser.getDesignHandle(ReportParser.java:158)
        at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.getReportDesignHandle(ReportEngineHelper.java:255)
        at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:274)
        at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:196)
        at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:130)
        at org.eclipse.birt.report.engine.api.impl.ReportEngine.openReportDesign(ReportEngine.java:295


[Updated on: Thu, 10 February 2011 14:32]

Report message to a moderator

Re: Error in an application integrating report engine [message #653712 is a reply to message #653650] Thu, 10 February 2011 18:57 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Are you using Eclipse to build the app? If so can you try setting the
build path the include the report engine download/ReportEngine/lib files
as a test? BTW if this app continues to run you are much better off
leaving the platform running and wrapping the engine creation in a
singleton. For every new client request just get the created engine and
use it to create a run and render task.

Jason

On 2/10/2011 9:30 AM, sco@tentelemed.com wrote:
> Hi all,
> I am currently integrating the report engine into a client/server
> application. The engine is on the server side and is due to send reports
> as byte arrays towards the client which will open them.
> Using Maven, I uploaded the Birt libraries onto the maven repository and
> set the BIRT_HOME to a location on my machine for test purpose which is
> obviously different from the maven repo.
> The app compiles, but when launching the report, an exception occurs at
> the engine.openReportDesign("") level. The thing is that when launching
> the report with the same BIRT_HOME and the ReportEngine in the classpath
> (thus no maven) from a simple project, the report is generated.
> I sense that this is a version problem, but I don't know where to look.
> Some insight would be most welcome.
>
> Thanks!
> the code that launches the report:
>
> ByteArrayOutputStream bos = new ByteArrayOutputStream();
> try {
> EngineConfig config = new EngineConfig();
> config.setBIRTHome("C:\\Documents and
> Settings\\sco\\Bureau\\birtruntime\\ReportEngine");
> Platform.startup(config);
> IReportEngineFactory factory = (IReportEngineFactory)
> Platform.createFactoryObject(IReportEngineFactory.EXTENSION_ REPORT_ENGINE_FACTORY);
>
> IReportEngine engine = factory.createReportEngine(config);
> IReportRunnable design = engine.openReportDesign("C:\\Documents and
> Settings\\sco\\Bureau\\birtruntime\\ReportEngine\\samples\\c ustomers.rptdesign ");
>
> IRunAndRenderTask task = engine.createRunAndRenderTask(design);
> task.setParameterValue("languageParameter", language);
> PDFRenderOption options = new PDFRenderOption();
> options.setOutputStream(bos);
> options.setOutputFormat("pdf");
> task.setRenderOption(options);
> task.run();
> task.close();
> engine.destroy();
> Platform.shutdown();
> } catch(Exception e) {
> e.printStackTrace();
> }
> return bos.toByteArray();
>
>
> And the exception:
>
> 10 févr. 2011 11:22:24
> org.eclipse.birt.report.model.metadata.MetaDataReader read
> GRAVE: null
> java.lang.NullPointerException
> at
> org.eclipse.birt.report.model.core.DesignElement.initSlots(D esignElement.java:2990)
>
> at
> org.eclipse.birt.report.model.elements.ReportDesignImpl.<init >(ReportDesignImpl.java:82)
>
> at
> org.eclipse.birt.report.model.elements.ReportDesign.<init>(ReportDesign.java:52)
>
> at
> org.eclipse.birt.report.model.parser.DesignParserHandler.<init >(DesignParserHandler.java:49)
>
> at
> org.eclipse.birt.report.model.parser.DesignReader.read(Desig nReader.java:86)
>
> at
> org.eclipse.birt.report.model.core.DesignSessionImpl.openDes ign(DesignSessionImpl.java:315)
>
> at
> org.eclipse.birt.report.model.api.SessionHandleImpl.openDesi gn(SessionHandleImpl.java:294)
>
> at
> org.eclipse.birt.report.engine.parser.ReportParser.getDesign Handle(ReportParser.java:158)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.g etReportDesignHandle(ReportEngineHelper.java:255)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:274)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:196)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:130)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngine.openRep ortDesign(ReportEngine.java:295
>
>
>
>
Re: Error in an application integrating report engine [message #653803 is a reply to message #653712] Fri, 11 February 2011 09:59 Go to previous messageGo to next message
Stephane Coquard is currently offline Stephane CoquardFriend
Messages: 8
Registered: February 2011
Junior Member
Thanks for the advice, I will take that into account when I will more seriously implement the report engine in the app.

I solved my issue. The problem came from a conflict between the apache xerces xml parser that should be used by the report engine and the gnu.jaxp parser that was imported form the maven repository. I now have to figure out a neat fix to this issue.

I thus now have a second problem. It seems as if birt cannot access the ReportEngine/plugins folder as I get the following error when launching the report and yet the requested jar (org.eclipse.birt.chart.reportitem_2.6.1.v20100914.jar) is present in the mentioned folder.
11 févr. 2011 12:29:53 org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
GRAVE: Message:The class [org.eclipse.birt.chart.reportitem.ChartReportItemFactoryImpl] can not be instantiated. Error code:FAILED_TO_CREATE_INSTANCE 
11 févr. 2011 12:30:19 org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
GRAVE: Message:The class [org.eclipse.birt.chart.reportitem.ChartScriptableClassInfo] can not be instantiated. Error code:FAILED_TO_CREATE_INSTANCE



Thanks!

[Updated on: Fri, 11 February 2011 11:38]

Report message to a moderator

Re: Error in an application integrating report engine [message #657580 is a reply to message #653803] Thu, 03 March 2011 11:08 Go to previous messageGo to next message
Arjan Loermans is currently offline Arjan LoermansFriend
Messages: 1
Registered: March 2011
Junior Member
Hi Mad1s0n,

I'm having the same 'FAILED_TO_CREATE_INSTANCE' messages, have you had any succes in fixing this?

Arjan
Re: Error in an application integrating report engine [message #657665 is a reply to message #657580] Thu, 03 March 2011 15:32 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Arjan,

Can you give some more detail? Also post the stack trace.

Jason

On 3/3/2011 6:08 AM, Arjan Loermans wrote:
> Hi Mad1s0n,
>
> I'm having the same 'FAILED_TO_CREATE_INSTANCE' messages, have you had
> any succes in fixing this?
>
> Arjan
Previous Topic:Grid formatting question
Next Topic:Birt viewer: default option "fit with page" in pdf export
Goto Forum:
  


Current Time: Sat Apr 20 04:17:59 GMT 2024

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

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

Back to the top