Error embedding "Web Service Data Source" with "JasperReport Library" in a java application

0

I am trying to integrate "JasperReport Library" into a Java application.
I have designed a report with "JasperSoft Studio" + "Web Service Data Source".
From "JasperSoft Studio" the report is generated correctly from:

  • Open With -> JasperReport preview.

But when I try to launch it from my java application it throws an exception:

java.lang.RuntimeException: Can't generate report.
        at org.gvsig.report.lib.impl.DefaultReport.generateReport(DefaultReport.java:114)
        at org.gvsig.report.swing.impl.DefaultJReport.set(DefaultJReport.java:55)
 
        ...
 
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: net.sf.jasperreports.engine.JRException: Error creating request: net.sf.jasperreports.engine.JRException: The verb can't be null
        at com.jaspersoft.webservice.data.util.WebServiceConnector.createRequestForWs(WebServiceConnector.java:187)
        at com.jaspersoft.webservice.data.util.WebServiceConnector.callWS(WebServiceConnector.java:134)
        at com.jaspersoft.webservice.data.query.WebServiceQueryExecuter.createDatasource(WebServiceQueryExecuter.java:168)
        at com.jaspersoft.webservice.data.query.WebServiceQueryExecuter.createDatasource(WebServiceQueryExecuter.java:1)
        at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1257)
        at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:726)
        at net.sf.jasperreports.engine.fill.BaseReportFiller.setParameters(BaseReportFiller.java:456)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:578)
        at org.gvsig.report.lib.impl.DefaultReport.generateReport(DefaultReport.java:109)
        ... 47 more
Caused by: net.sf.jasperreports.engine.JRException: The verb can't be null
        at com.jaspersoft.webservice.data.util.WebServiceConnector.createRequestForWs(WebServiceConnector.java:178)
        ... 55 more

The code I am using is the following:

    @Override
    public Object generateReport(SimpleTaskStatus status) {
       InputStream inputStream = null;
        try {
            inputStream = new FileInputStream(this.getFile());
            Map parameters = new HashMap();
            JasperDesign jasperDesign = JRXmlLoader.load(inputStream);
 
            JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
 
            JasperReportsContext jasperReportsContext = DefaultJasperReportsContext.getInstance();
            ReportFiller filler = JRFiller.createReportFiller(jasperReportsContext, jasperReport);
            filler.addFillListener(new FillListener() {
                @Override
                public void pageGenerated(JasperPrint jasperPrint, int pageIndex) {
                    LOG.info("Pagina generada "+pageIndex);
                }
 
                @Override
                public void pageUpdated(JasperPrint jasperPrint, int pageIndex) {
                    LOG.info("Pagina actualizada "+pageIndex);
                }
            });
            JasperPrint jasperPrint = filler.fill(parameters);  //<<-- line 109: here crash
 
            return jasperPrint;
 
        } catch (Exception ex) {
            throw new RuntimeException("Can't generate report.", ex);
 
        } finally {
            try {
                if( inputStream!=null ) {
                    inputStream.close();
                }
            } catch (IOException ex) {
 
            }
        }
    }

The jars that I am including are those that correspond with the dependencies of:

  • jasperreports-6.6.0.jar

But the ones that I have supposed that "Web Service Data Source" requires:

  • WebServiceDataAdapter.jar
  • GoogleAuthenticator.jar
  • ElasticSearchConnector.jar

Do I need to configure something to use "Web Service Data Source" from my application?

Any clue that you can give me I would appreciate it.


a greeting
Joaquin

jjdelcerro's picture
Joined: Sep 15 2014 - 1:07am
Last seen: 1 year 6 months ago

0 Answers:

No answers yet
Feedback
randomness