Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » BIRT Engine cant open report after stop/start app in tomcat
BIRT Engine cant open report after stop/start app in tomcat [message #660926] Tue, 22 March 2011 11:44 Go to next message
Eclipse User is currently offline Eclipse UserFriend
Messages: 4
Registered: March 2011
Location: Russia
Junior Member
Hello.

I write simple spring webapp to render BIRT report in html format.
My BIRT runtime (2.6.2) installed in /J2EE/birt-runtime-2_6_2/ReportEngine/ directory

When I run app first time, all is OK, a see report on the page.
But when I redeploy app, or start and then stop it using Tomcat Manager I get this exception when access page:

java.lang.NullPointerException
	org.eclipse.birt.report.model.metadata.ExtensionManagerImpl.initialize(ExtensionManagerImpl.java:103)
	org.eclipse.birt.report.model.metadata.MetaDataDictionary.intializeExtension(MetaDataDictionary.java:1169)
	org.eclipse.birt.report.model.api.impl.DesignEngineImpl.initialize(DesignEngineImpl.java:99)
	org.eclipse.birt.report.model.api.impl.DesignEngineImpl.newSessionHandle(DesignEngineImpl.java:147)
	org.eclipse.birt.report.model.api.DesignEngine.newSessionHandle(DesignEngine.java:120)
	org.eclipse.birt.report.engine.parser.ReportParser.getDesignHandle(ReportParser.java:143)
	org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.getReportDesignHandle(ReportEngineHelper.java:255)
	org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:274)
	org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:196)
	org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:130)
	org.eclipse.birt.report.engine.api.impl.ReportEngine.openReportDesign(ReportEngine.java:295)


I wrote JUnit test class to check this behaviour:
package birt;

import java.io.*;
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.*;
import org.junit.Test;

public class BirtTest {

  @Test
  public void testReport() throws IOException, BirtException {

    String report = "/J2EE/birt-runtime-2_6_2/WebViewerExample/test.rptdesign";

    BirtEngine birtEngine = new BirtEngine();
    birtEngine.render(report);
    birtEngine.shutdown();

//    BirtEngine birtEngine2 = new BirtEngine();
//    birtEngine2.render(report);
//    birtEngine2.shutdown();
  }

  public static class BirtEngine {

  private IReportEngine reportEngine;

    public BirtEngine() throws BirtException {
      EngineConfig config = new EngineConfig();
      config.setBIRTHome("/home/shumilin/J2EE/birt-runtime-2_6_2/ReportEngine/");
      config.setLogConfig("/home/shumilin/J2EE/birt-runtime-2_6_2/logs/", Level.FINEST);

      Platform.startup(config);

      IReportEngineFactory factory =
          (IReportEngineFactory) Platform.createFactoryObject(
              IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);

      reportEngine = factory.createReportEngine(config);
    }

    public void shutdown() {

      if(reportEngine == null)
        return;

      reportEngine.destroy();
      Platform.shutdown();

      reportEngine = null;
    }

    public String render(String report) throws EngineException, UnsupportedEncodingException {
      IReportRunnable runnable = reportEngine.openReportDesign(report);
      IRunAndRenderTask runAndRenderTask = reportEngine.createRunAndRenderTask(runnable);

      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      HTMLRenderOption options = new HTMLRenderOption();
      options.setOutputFormat("html");
      options.setOutputStream(bos);
      options.setEmbeddable(true);
      runAndRenderTask.setRenderOption(options);
      runAndRenderTask.run();

      return new String(bos.toByteArray(), "UTF-8");
    }
  }
}


and execution fails on commented lines in test
birtEngine2.render(report)
with the same exception. log file contains only this additional info:

Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.engine.api.impl.ReportEngine openReportDesign
FINE: ReportEngine.openReportDesign: designName=/J2EE/birt-runtime-2_6_2/WebViewerExample/test.rptdesign 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-header] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-detail] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-row-header] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-column-header] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-row-grand-total] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-column-grand-total] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-row-sub-total] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-column-sub-total] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-cell] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 
Mar 22, 2011 2:18:47 PM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [chart] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME 


When I comment
Platform.shutdown()
and run test- all is OK, but it looks like a hack.

What's wrong with my code, or maybe with my BIRT installation?

Can somebody help me with this issue, please.
Re: BIRT Engine cant open report after stop/start app in tomcat [message #665789 is a reply to message #660926] Fri, 15 April 2011 23:47 Go to previous messageGo to next message
Sean Tong is currently offline Sean TongFriend
Messages: 2
Registered: July 2009
Junior Member

I am running into the same issue. Have you found a work-around?
Re: BIRT Engine cant open report after stop/start app in tomcat [message #665792 is a reply to message #665789] Sat, 16 April 2011 00:40 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you post the BIRT and tomcat version? What code are you using?

Jason

On 4/15/2011 7:47 PM, Sean Tong wrote:
>
> I am running into the same issue. Have you found a work-around?
Re: BIRT Engine cant open report after stop/start app in tomcat [message #666090 is a reply to message #665792] Tue, 19 April 2011 05:32 Go to previous messageGo to next message
Eclipse User is currently offline Eclipse UserFriend
Messages: 4
Registered: March 2011
Location: Russia
Junior Member
My environment:
BIRT 2.6.2 (Birt runtime without any changes installed in BIRT_HOME)
Tomcat 6.0.26 (installed in TOMCAT_HOME)
JUnit 4.8
IntelliJ IDEA 10

1) Tomcat workaround:

My mistake was, that I'd put all jars from BIRT_HOME/lib into TOMCAT_HOME/lib. It's bad idea.
After several experiments I'd left only this jars in TOMCAT_HOME/lib:

- com.ibm.icu_4.2.1.v20100412.jar
- js.jar

But I had to include these jars into WEB-INF/lib folder of webapp, not in TOMCAT_HOME/lib:
- coreapi.jar
- engineapi.jar
- modelapi.jar

2) IntelliJ workaround (for running JUnit test)

Problem with JUnit test was in wrong configuration of Shared lib, used for running test.
I'd defined Global library with too many jars (all from BIRT_HOME/plugins + BIRT_HOME/libs)
When I'd left only BIRT_HOME/libs test worked.


P.S. I think, set of jars, wich have to be in classpath of webapp, depends on content of report.
For my production report, where I use css, I have to add (in TOMCAT_HOME/lib):
- flute.jar
- org.w3c.css.sac_1.3.0.v200805290154.jar

This deploy configuration works for me, but may be you should tune yours additionally.

Jason, what can you say about such implementation of Enterprise App for WebSphere, wich depends on BIRT:
- I've 10-15 independent webapps in ear.
- All use BIRT for reporting and all need functionality of WebViewer.
- I cant physically add WebViewer (50M) into each webapp
- I cant install WebViewer side by side, because I use my app classes in reports

So I decided to write custom ReportGenerator (see post above)
and generate reports manually with single BIRT installation in BIRT_HOME.
Re: BIRT Engine cant open report after stop/start app in tomcat [message #666338 is a reply to message #666090] Wed, 20 April 2011 02:27 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Any chance we can get this wrapped up in a bugzilla entry. We are
currently working on a simplified runtime and it would be good to get
this scenario addressed. Also not you could use the BIRT tag libraries
and do cross context.

Jason

On 4/19/2011 1:32 AM, S.Shumilin wrote:
> My environment:
> BIRT 2.6.2 (Birt runtime without any changes installed in BIRT_HOME)
> Tomcat 6.0.26 (installed in TOMCAT_HOME)
> JUnit 4.8
> IntelliJ IDEA 10
>
> 1) Tomcat workaround:
>
> My mistake was, that I'd put all jars from BIRT_HOME/lib into
> TOMCAT_HOME/lib. It's bad idea.
> After several experiments I'd left only this jars in TOMCAT_HOME/lib:
>
> - com.ibm.icu_4.2.1.v20100412.jar
> - js.jar
>
> But I had to include these jars into WEB-INF/lib folder of webapp, not
> in TOMCAT_HOME/lib:
> - coreapi.jar
> - engineapi.jar
> - modelapi.jar
>
> 2) IntelliJ workaround (for running JUnit test)
>
> Problem with JUnit test was in wrong configuration of Shared lib, used
> for running test.
> I'd defined Global library with too many jars (all from
> BIRT_HOME/plugins + BIRT_HOME/libs)
> When I'd left only BIRT_HOME/libs test worked.
>
>
> P.S. I think, set of jars, wich have to be in classpath of webapp,
> depends on content of report.
> For my production report, where I use css, I have to add (in
> TOMCAT_HOME/lib):
> - flute.jar
> - org.w3c.css.sac_1.3.0.v200805290154.jar
>
> This deploy configuration works for me, but may be you should tune yours
> additionally.
>
> Jason, what can you say about such implementation of Enterprise App for
> WebSphere, wich depends on BIRT:
> - I've 10-15 independent webapps in ear.
> - All use BIRT for reporting and all need functionality of WebViewer.
> - I cant physically add WebViewer (50M) into each webapp
> - I cant install WebViewer side by side, because I use my app classes in
> reports
>
> So I decided to write custom ReportGenerator (see post above)
> and generate reports manually with single BIRT installation in BIRT_HOME.
Re: BIRT Engine cant open report after stop/start app in tomcat [message #666354 is a reply to message #666338] Wed, 20 April 2011 06:00 Go to previous messageGo to next message
Eclipse User is currently offline Eclipse UserFriend
Messages: 4
Registered: March 2011
Location: Russia
Junior Member
Thanks for reply.
We'll wait new features and enhancements with impatience.
Re: BIRT Engine cant open report after stop/start app in tomcat [message #686395 is a reply to message #666354] Wed, 22 June 2011 07:09 Go to previous messageGo to next message
Gaurav  is currently offline Gaurav Friend
Messages: 20
Registered: June 2011
Junior Member
Hi Guys

I have the same problem , with a scripted data source report.I have 2 runs in my test. In the first run the report runs successfully with no errors, but in the second it returns with the following exception:

java.lang.NullPointerException
at org.eclipse.birt.report.model.metadata.ExtensionManagerImpl.initialize(ExtensionManagerIm
pl.java:103)
at org.eclipse.birt.report.model.metadata.MetaDataDictionary.intializeExtension(MetaDataDict
ionary.java:1169)
at org.eclipse.birt.report.model.api.impl.DesignEngineImpl.initialize(DesignEngineImpl.java:
99)
at org.eclipse.birt.report.model.api.impl.DesignEngineImpl.newSessionHandle(DesignEngineImpl
.java:147)
at org.eclipse.birt.report.model.api.DesignEngine.newSessionHandle(DesignEngine.java:120)
at org.eclipse.birt.report.engine.parser.ReportParser.getDesignHandle(ReportParser.java:143)

at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.getReportDesignHandle(ReportEn
gineHelper.java:255)
at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineH
elper.java:274)
at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineH
elper.java:184)
at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineH
elper.java:161)
at org.eclipse.birt.report.engine.api.impl.ReportEngine.openReportDesign(ReportEngine.java:3
34)

I get the following in my Report logs:
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.engine.api.impl.ReportEngine openReportDesign
FINE: ReportEngine.openReportDesign: designStream=java.io.FileInputStream@59aa86
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [chart] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [Chart] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-header] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-detail] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-row-header] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-column-header] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-row-grand-total] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-column-grand-total] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-row-sub-total] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-column-sub-total] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [Crosstab] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [CrosstabView] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [DimensionView] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [LevelView] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [MeasureView] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [ComputedMeasureView] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate style names when adding the predefined style [crosstab-cell] to the meta-data dictionary. Error code:DUPLICATE_STYLE_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [CrosstabCell] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME
22 Jun, 2011 10:39:38 AM org.eclipse.birt.report.model.metadata.ExtensionLoader handleError
SEVERE: Message:Duplicate extension name when adding the extension [AggregationCell] to the meta-data dictionary. Error code:DUPLICATE_EXTENSION_NAME


Kindly advise what needs to be done.

My environment details are:
birt 2.6.2
tomcat 6.0.20

[Updated on: Wed, 22 June 2011 07:13]

Report message to a moderator

Re: BIRT Engine cant open report after stop/start app in tomcat [message #686466 is a reply to message #686395] Wed, 22 June 2011 09:34 Go to previous messageGo to next message
Gaurav  is currently offline Gaurav Friend
Messages: 20
Registered: June 2011
Junior Member
Debugging into the BIRT source code leads me to the following lines of code:


// load all the oda data sources and oda data sets
// OdaExtensionLoader.load( );
OdaExtensionLoaderFactory.getInstance( ).createOdaExtensionLoader( )
.load( );

The .load() call leads to Null pointer exception.

Thanks in advance
Re: BIRT Engine cant open report after stop/start app in tomcat [message #686592 is a reply to message #686466] Wed, 22 June 2011 14:58 Go to previous messageGo to next message
Gaurav  is currently offline Gaurav Friend
Messages: 20
Registered: June 2011
Junior Member
Yes commenting the Platform.shutdown() helped accomplish the task.

Would this be considered as a hack?
Re: BIRT Engine cant open report after stop/start app in tomcat [message #686616 is a reply to message #686592] Wed, 22 June 2011 15:40 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

It would be good to log when the Platform.shutdown is being called before commenting it out. When you redeploy does it shutdown? Also BIRT 3.7 is now available with a new runtime. You may want to give this a try.

Jason
Re: BIRT Engine cant open report after stop/start app in tomcat [message #689260 is a reply to message #686616] Mon, 27 June 2011 09:35 Go to previous messageGo to next message
Gaurav  is currently offline Gaurav Friend
Messages: 20
Registered: June 2011
Junior Member
Hi Jason

Thanks for the reply.

Being a novice to BIRT, I would do a Platform.startup before the runAndRenderTask execution and a Platform.shutdown once the task was run.

Could you please then suggest, what is a recommended practice for startup and shutdown of the platform?

I would certainly want to give runtime 3.7 a try.

Thanks again

Gaurav
Re: BIRT Engine cant open report after stop/start app in tomcat [message #689417 is a reply to message #689260] Mon, 27 June 2011 15:44 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

For 2.6.2 you want to only shutdown the engine when the servlet is
destroyed. See:
http://wiki.eclipse.org/Servlet_Example_(BIRT)_2.1

Jason

On 6/27/2011 5:35 AM, Gaurav wrote:
> Hi Jason
>
> Thanks for the reply.
> Being a novice to BIRT, I would do a Platform.startup before the
> runAndRenderTask execution and a Platform.shutdown once the task was run.
>
> Could you please then suggest, what is a recommended practice for
> startup and shutdown of the platform?
>
> I would certainly want to give runtime 3.7 a try.
>
> Thanks again
>
> Gaurav
Re: BIRT Engine cant open report after stop/start app in tomcat [message #689658 is a reply to message #689417] Tue, 28 June 2011 06:10 Go to previous message
Gaurav  is currently offline Gaurav Friend
Messages: 20
Registered: June 2011
Junior Member

Thanks a ton Jason.
Previous Topic:Merging BIRT .rptdesign
Next Topic:word in column cannot wrap
Goto Forum:
  


Current Time: Fri Apr 19 21:08:20 GMT 2024

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

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

Back to the top