Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Execute Report with an XMLStream throws an Exception(CannotFetchNextRow)
Execute Report with an XMLStream throws an Exception [message #1009312] Thu, 14 February 2013 21:56 Go to next message
Samo B. is currently offline Samo B.Friend
Messages: 41
Registered: December 2012
Member
Hi,

I was working on the example "ExecuteReport" with an rptdesign which has an xml as a datasource.

-BIRT runtime 4-2-1

This ist my Java apllication:

public class ExecuteReport {
        public static void executeReport() throws EngineException {
                 
            IReportEngine engine = null;
            EngineConfig config = null;
         
            try {
                config = new EngineConfig();          
                //config.setBIRTHome("C:\\birt\\birt-runtime-2_2_1\\birt-runtime-2_2_1\\ReportEngine");
                config.setLogConfig("c:/temp/test", Level.FINEST);
                Platform.startup(config);
                final IReportEngineFactory FACTORY = (IReportEngineFactory) Platform
                    .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
                engine = FACTORY.createReportEngine(config);       
         
                // Open the report design
                IReportRunnable design = null;
                design = engine.openReportDesign("C:/02_ExecuteReport.rptdesign"); 
                IRunAndRenderTask task = engine.createRunAndRenderTask(design);        
                // task.setParameterValue("Top Count", (new Integer(5)));
                // task.validateParameters();
         
                final HTMLRenderOption HTML_OPTIONS = new HTMLRenderOption();       
                HTML_OPTIONS.setOutputFileName("C:Parmdisp.html");
                HTML_OPTIONS.setOutputFormat("html");
                // HTML_OPTIONS.setHtmlRtLFlag(false);
                // HTML_OPTIONS.setEmbeddable(false);
                // HTML_OPTIONS.setImageDirectory("C:\\test\\images");
         
                // PDFRenderOption PDF_OPTIONS = new PDFRenderOption();
                // PDF_OPTIONS.setOutputFileName("c:/temp/test.pdf");
                // PDF_OPTIONS.setOutputFormat("pdf");
         
                task.setRenderOption(HTML_OPTIONS);
                task.run();
                task.close();
                engine.destroy();
            } catch(final Exception EX) {
                EX.printStackTrace();
            } finally {
               Platform.shutdown();
            }
        }
 
    /**
     * @param ARGUMENTS
     */
    public static void main(final String[] ARGUMENTS) {
        try {
                executeReport();
        } catch (final Exception EX) {
           EX.printStackTrace();
        }
    }
}


This is my XML-Url : http://www.heise.de/.../heise-atom.xml

If I run the the report in my eclipse designer (Run -> View Report -> HTML) it works fine.
But If I run it in my Application I get following exception:


The following items have errors:

Table (id = 9):
- Cannot fetch the next data row.
    org.eclipse.datatools.connectivity.oda.OdaException ;
    java.net.ConnectException: Connection timed out: connect (Element ID:9)
odaconsumer.CannotFetchNextRow ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: Cannot fetch the next data row.
    org.eclipse.datatools.connectivity.oda.OdaException ;
    java.net.ConnectException: Connection timed out: connect (Element ID:9)
        at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1237)
        at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1216)
        at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96)
        at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)
        at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
        at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
        at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
        at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
        at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
        at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)
        at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
        at ExecuteReport.executeReport(ExecuteReport.java:52)
        at ExecuteReport.main(ExecuteReport.java:67)
Caused by: org.eclipse.birt.data.engine.odaconsumer.OdaDataException: Cannot fetch the next data row.
    org.eclipse.datatools.connectivity.oda.OdaException ;
    java.net.ConnectException: Connection timed out: connect
        at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.newException(ExceptionHandler.java:52)
        at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.throwException(ExceptionHandler.java:108)
        at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.throwException(ExceptionHandler.java:84)
        at org.eclipse.birt.data.engine.odaconsumer.ResultSet.fetch(ResultSet.java:143)
        at org.eclipse.birt.data.engine.executor.cache.OdiAdapter.fetch(OdiAdapter.java:214)
        at org.eclipse.birt.data.engine.executor.cache.RowResultSet.doNext(RowResultSet.java:113)
        at org.eclipse.birt.data.engine.executor.cache.RowResultSet.next(RowResultSet.java:91)
        at org.eclipse.birt.data.engine.executor.cache.ExpandableRowResultSet.next(ExpandableRowResultSet.java:63)
        at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.populateData(SmartCacheHelper.java:316)
        at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.initInstance(SmartCacheHelper.java:285)
        at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.initOdaResult(SmartCacheHelper.java:154)
        at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.getResultSetCache(SmartCacheHelper.java:79)
        at org.eclipse.birt.data.engine.executor.cache.SmartCache.<init>(SmartCache.java:57)
        at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.populateOdiResultSet(PassUtil.java:99)
        at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.pass(PassUtil.java:62)
        at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.doSinglePass(PassManager.java:170)
        at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.prepareDataSetResultSet(PassManager.java:94)
        at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.pass(PassManager.java:134)
        at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.populateResultSet(PassManager.java:74)
        at org.eclipse.birt.data.engine.executor.transform.ResultSetPopulator.populateResultSet(ResultSetPopulator.java:198)
        at org.eclipse.birt.data.engine.executor.transform.CachedResultSet.<init>(CachedResultSet.java:97)
        at org.eclipse.birt.data.engine.executor.DataSourceQuery.execute(DataSourceQuery.java:1062)
        at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.executeOdiQuery(PreparedOdaDSQuery.java:428)
        at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:1142)
        at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:232)
        at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:177)
        at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:98)
        at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:168)
        at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:267)
        at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1939)
        at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
        ... 11 more
Caused by: org.eclipse.datatools.connectivity.oda.OdaException ;
    java.net.ConnectException: Connection timed out: connect
        at org.eclipse.datatools.enablement.oda.xml.util.ResourceLocatorUtil.getInputStream(ResourceLocatorUtil.java:57)
        at org.eclipse.datatools.enablement.oda.xml.util.XMLSourceFromPath.openInputStream(XMLSourceFromPath.java:43)
        at org.eclipse.datatools.enablement.oda.xml.util.SaxParser.<init>(SaxParser.java:81)
        at org.eclipse.datatools.enablement.oda.xml.util.SaxParserConsumer.<init>(SaxParserConsumer.java:116)
        at org.eclipse.datatools.enablement.oda.xml.impl.ResultSet.next(ResultSet.java:142)
        at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaResultSet.next(OdaResultSet.java:180)
        at org.eclipse.birt.data.engine.odaconsumer.ResultSet.fetch(ResultSet.java:138)
        ... 38 more
Caused by: java.net.ConnectException: Connection timed out: connect
        at java.net.DualStackPlainSocketImpl.connect0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
        at java.net.Socket.connect(Socket.java:579)
        at java.net.Socket.connect(Socket.java:528)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:378)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:473)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:203)
        at sun.net.www.http.HttpClient.New(HttpClient.java:290)
        at sun.net.www.http.HttpClient.New(HttpClient.java:306)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:995)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:931)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:849)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1299)
        at java.net.URL.openStream(URL.java:1035)
        at org.eclipse.datatools.enablement.oda.xml.util.ResourceLocatorUtil.getInputStream(ResourceLocatorUtil.java:49)
        ... 44 more


Cheers!
Re: Execute Report with an XMLStream throws an Exception [message #1009469 is a reply to message #1009312] Fri, 15 February 2013 07:38 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Your link does not work for the XML. Can you re-post it?

Jason
Re: Execute Report with an XMLStream throws an Exception [message #1009508 is a reply to message #1009312] Fri, 15 February 2013 08:55 Go to previous messageGo to next message
Samo B. is currently offline Samo B.Friend
Messages: 41
Registered: December 2012
Member
Oh sorry!

http://www.heise.de/newsticker/heise-atom.xml

I've also tested a second link which doesn't work either:

http://www.wormser-zeitung.de/sitemap.xml


Tahnks,
Samet
Re: Execute Report with an XMLStream throws an Exception [message #1011015 is a reply to message #1009508] Mon, 18 February 2013 17:12 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Samet

Can you post the design you are using so we can try to reproduce the issue?

Jason
Re: Execute Report with an XMLStream throws an Exception [message #1011053 is a reply to message #1011015] Mon, 18 February 2013 18:38 Go to previous messageGo to next message
Samo B. is currently offline Samo B.Friend
Messages: 41
Registered: December 2012
Member
Hi Jason,

Here is the report. But this is just a simple report with a table.

Thanks,
Samet
Re: Execute Report with an XMLStream throws an Exception [message #1011547 is a reply to message #1011053] Tue, 19 February 2013 19:18 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I just tried the following code with your report and it worked fine:


import java.util.Locale;
import java.util.logging.Level;

import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EXCELRenderOption;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.PDFRenderOption;
import org.eclipse.birt.report.engine.api.RenderOption;
import org.eclipse.birt.report.engine.api.impl.RunAndRenderTask;
import org.eclipse.birt.report.engine.api.script.IReportContext;


public class RunAndRenderTaskTest {

public void runReport() throws EngineException
{

RunAndRenderTask task=null;
IReportEngine engine=null;
EngineConfig config = null;

try{
config = new EngineConfig( );
Platform.startup( config );

IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );


IReportRunnable design = null;
//Open the report design

design = engine.openReportDesign("Reports/sitetest.rptdesign");
task = (RunAndRenderTask) engine.createRunAndRenderTask(design);
task.setLocale(new Locale("en", "US"));
//IReportContext irc = task.getReportContext();
//task.setParameterValue("Top Count", (new Integer(5)));
//task.validateParameters();


HTMLRenderOption options = new HTMLRenderOption();
options.setImageDirectory("./");
options.setOutputFileName("output/resample/external.html");
options.setOutputFormat("html");
//options.setEmbeddable(false);
//options.setEnableMetadata(true);
//options.setEnableInlineStyle(false);
//options.setEnableAgentStyleEngine(true);
//options.setEnableCompactMode(true);

//PDFRenderOption options = new PDFRenderOption();
//options.setOutputFileName("output/resample/bookmark.pdf");
//options.setSupportedImageFormats("PNG;GIF;JPG;BMP;SWF;SVG");
//options.setOutputFormat("pdf");

//EXCELRenderOption options = new EXCELRenderOption();
//options.setOutputFormat("xls");
//options.setOutputFileName("output/resample/customers.xls");
//options.setWrappingText(true);


task.setRenderOption(options);
task.run();

IReportContext irc = task.getReportContext();

task.close();
engine.destroy();
}catch( Exception ex){
ex.printStackTrace();
}
Platform.shutdown( );
System.out.println("Finished");



}


/**
* @param args
*/
public static void main(String[] args) {
try
{

RunAndRenderTaskTest ex = new RunAndRenderTaskTest( );
ex.runReport();

System.exit(0);

}
catch ( Exception e )
{
e.printStackTrace();
}
}
}

Jason
Re: Execute Report with an XMLStream throws an Exception [message #1012340 is a reply to message #1011547] Thu, 21 February 2013 11:33 Go to previous messageGo to next message
Samo B. is currently offline Samo B.Friend
Messages: 41
Registered: December 2012
Member
Thank you Jason.
I also had a problme with my Proxy.
It works now.

Is there any way to modify the existing dataset?
I'm trying to add a new filter to my dataset because I will get parameters from a servlet and according to the parameters I want to add filter.


Almost the same way I want to do for the datasoruce to modify the XMl-URL.
In this casae I now there is a way to do it with an EventHandler but is there a different way except that? For example to modify the datasource in my ExecuteReport class?

Cheers,
Samet

[Updated on: Thu, 21 February 2013 11:38]

Report message to a moderator

Re: Execute Report with an XMLStream throws an Exception [message #1012402 is a reply to message #1012340] Thu, 21 February 2013 13:51 Go to previous message
Samo B. is currently offline Samo B.Friend
Messages: 41
Registered: December 2012
Member
I found it:

SlotHandle sh = design.getDesignHandle().getModuleHandle().getDataSets();
DataSetHandle dsh = design.getDesignHandle().getModuleHandle().findDataSet("TEST");

FilterCondition fc = new FilterCondition();

fc.setExpr("");
fc.setOperator("");
fc.setExpr("");
fc.setValue1("");
fc.setValue2("");

dsh.addFilter(fc);

Thank you Jason! It was very helpful.

Regards,
Samet

[Updated on: Thu, 21 February 2013 15:17]

Report message to a moderator

Previous Topic:Tool tip was displayed twice in firefox
Next Topic:It is possible to duplicate the current feature of report viewer using GWT
Goto Forum:
  


Current Time: Tue Apr 23 09:02:14 GMT 2024

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

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

Back to the top