Transfer JasperReports 3.0 Java-Program To JasperReports 5.6

0

Hello,

we use in our company a java Proramm with JasperReports 3.0 and Microsoft Analysis Services OLAP Server 2005. 

This is the old Code:

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporter;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JRResultSetDataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.export.JRCsvExporter;
import net.sf.jasperreports.engine.export.JRCsvExporterParameter;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.query.JRXmlaQueryExecuterFactory;
import net.sf.jasperreports.engine.util.JRLoader;
 
        String strQuelle = "";
        String strZiel = "";
        String strPrintReport = "";
 
        Map params = null;
        JasperPrint jasperPrint = null;
 
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        String uhrzeit = sdf.format(new Date());
        uhrzeit = uhrzeit.replaceAll(":", "_");
 
        params = new HashMap();
 
 
        strQuelle = "Kassenportrait V5.jasper";
        strZiel = "P_" + uhrzeit + "_" + getSessionBean1().strUser_ID + ".pdf";
        strPrintReport = "P_" + uhrzeit + "_" + getSessionBean1().strUser_ID + ".jrprint";
 
 
        params.put(JRXmlaQueryExecuterFactory.PARAM_XMLA_URL, url_Cube);
        params.put(JRXmlaQueryExecuterFactory.PARAM_XMLA_DS, ds_Cube);
        params.put(JRXmlaQueryExecuterFactory.PARAM_XMLA_CAT, cat_Cube);
        params.put(net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuterFactory.PARAMETER_XMLA_URL, url_Cube);
        params.put(net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuterFactory.PARAMETER_XMLA_DATASOURCE, ds_Cube);
        params.put(net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuterFactory.PARAMETER_XMLA_CATALOG, cat_Cube);
 
 
        if (userName_Cube != null && userName_Cube.length() > 0) {
            String tmpPassword = password_Cube;
            Authenticator.setDefault(new HTTPAuth(userName_Cube, tmpPassword));
            params.put(net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuterFactory.PARAMETER_XMLA_USER, userName_Cube);
            params.put(net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuterFactory.PARAMETER_XMLA_PASSWORD, tmpPassword);
        }
 
        net.sf.jasperreports.engine.util.JRProperties.setProperty("net.sf.jasperreports.query.executer.factory.xmla-mdx", "net.sf.jasperreports.engine.query.JRXmlaQueryExecuterFactory");
        {
 
            try {
 
                JasperFillManager.fillReportToFile(strQuelle, strPrintReport, params);
                File file = new File(strPrintReport);
                jasperPrint = (JasperPrint) JRLoader.loadObject(file);
 
                JRExporter exporter = new JRPdfExporter();
                exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
                exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, strZiel);
 
                exporter.exportReport();
 
 
            } catch (JRException ex) {
                Logger.getLogger(Kassen.class.getName()).log(Level.SEVERE, null, ex);
            } catch (RuntimeException e) {
                throw e;
            }
        }
 

How may I transfer this code in JasperReports 5.6.

Error: net.sf.jasperreports.engine.JRException: Class net.sf.jasperreports.engine.query.JRXmlaQueryExecuterFactory not found.

Thanks

Patrick

plange's picture
6
Joined: Feb 5 2007 - 9:42pm
Last seen: 4 months 2 weeks ago

1 Answer:

1
hozawa's picture
46727
Joined: Apr 24 2010 - 4:31pm
Last seen: 2 months 1 week ago
Feedback
randomness