plange Posted June 25, 2014 Posted June 25, 2014 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; } } [/code]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.ThanksPatrick
Solution hozawa Posted June 27, 2014 Solution Posted June 27, 2014 Seems like it's been moved to olap package.http://jasperreports.sourceforge.net/api/net/sf/jasperreports/olap/xmla/JRXmlaQueryExecuterFactory.html
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now