6 Replies Latest reply on Sep 22, 2009 5:30 PM by gonzalad

    birt - Seam component always null with birt embed

    gonzalad Apprentice

      Hello,

      I'm using a Seam component in birt report (from a scripted datasource).
      When I try to access a Seam Component from a birt report and when I use embed mode(designType="embed"), Seam component is always null.
      When I use designType="run", everything works fine.

      I don't understand why.
      It appears to me to have a relation with UIDocument's logic when we call JBossBirtServlet with an URLConnection :

      URL birtURL = new URL(urlString);
      URLConnection connection = birtURL.openConnection();
      InputStream stream = connection.getInputStream();
      

      When I change this code from UIDocument code to use requestDispatcher.include, it works fine.

      Should I open a JIRA issue (with test case) ?

      Thanks for your help !

      My jsf page output :
      The following items have errors:
      
      ReportDesign (id = 1):
      + There are errors evaluating script "importPackage(Packages.org.jboss.seam);
      importPackage(Packages.org.apache.log4j);
      sampleReportList = Component.getInstance("sampleReportList", false);
      logger = Logger.getLogger("com.natixis.birt");
      logger.warn("sampleReportList = "+sampleReportList);
      reportsIterator = sampleReportList.getNames().iterator();
      ":
      {1}.
      
      Error.ScriptEvaluationError ( 1 time(s) )detail : org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "importPackage(Packages.org.jboss.seam);importPackage(Packages.org.apache.log4j);
      sampleReportList = Component.getInstance("sampleReportList", false);
      logger = Logger.getLogger("com.natixis.birt");
      logger.warn("sampleReportList = "+sampleReportList);
      reportsIterator = sampleReportList.getNames().iterator();":{1}.
      at org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor.handleJS(DtEScriptExecutor.java:77)
      ...
      Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: There are errors evaluating script "__bm_OPEN()":TypeError: Cannot call method "getNames" of null (<inline>#7). See next exception for more information.There are errors evaluating script "__bm_OPEN()":TypeError: Cannot call method "getNames" of null (<inline>#7) at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:118)
      TypeError: Cannot call method "getNames" of null (<inline>#7) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)
      ...
      + There are errors evaluating script "if( !( reportsIterator.hasNext()) ){
       return( false );
      }
      var report = reportsIterator.next();
      row["Name"] = report;
      return ( true );":
      {1}.
      
      Error.ScriptEvaluationError ( 1 time(s) )detail : org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "if( !( reportsIterator.hasNext()) ){ return( false );}var report = reportsIterator.next();row["Name"] = report;return ( true );":{1}. at ...
      org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor.handleJS(Dtorg.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: There are errors evaluating script "__bm_FETCH()":ReferenceError: "reportsIterator" n'est pas défini (<inline>#2). See next exception for more information.There are errors evaluating script "__bm_FETCH()":ReferenceError: "reportsIterator" n'est pas defini (<inline>#2) at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:118) at
      ...
      + data.engine.BadFetchScriptReturnType
      


      My sysout :
      17:10:52,979 WARN [birt] sampleReportList = null
      17:10:53,042 ERROR [STDERR] 22 sept. 2009 17:10:53 org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor handleJS
      ATTENTION: A BIRT exception occurred: There are errors evaluating script "__bm_OPEN()":
      TypeError: Cannot call method "getNames" of null (<inline>#7). See next exception for more information.
      There are errors evaluating script "__bm_OPEN()":
      TypeError: Cannot call method "getNames" of null (<inline>#7)
      org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: There are errors evaluating script "__bm_OPEN()":
      TypeError: Cannot call method "getNames" of null (<inline>#7). See next exception for more information.
      There are errors evaluating script "__bm_OPEN()":
      TypeError: Cannot call method "getNames" of null (<inline>#7)
       at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:118)
       at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:717)
       at org.eclipse.birt.data.engine.script.JSMethodRunner.runScript(JSMethodRunner.java:76)
      


      And the open method from my scripted datasource :
      importPackage(Packages.org.jboss.seam);
      importPackage(Packages.org.apache.log4j);
      sampleReportList = Component.getInstance("sampleReportList", false);
      logger = Logger.getLogger("com.natixis.birt");
      logger.warn("sampleReportList = "+sampleReportList);
      reportsIterator = sampleReportList.getNames().iterator();