title: JasperReports: fillReport in Java with XML-A datasource (Olap)
body: <p>I have a <em>Java</em> service that I generates reports with the <em>JasperReports 4.0.5</em> library. It works well with standard JDBC datasource. <br/>
  Now I am trying to run it on olap datasource, then connecting me to a XML-A server.
  In the design phase with <em>iReport</em>, everything runs, but when I run it in <em>Java</em>, I get an error "NullPointerException" on execution!<br/>
  I's using <em>olap4j</em> library to connect to the data source, the same one used by <em>iReport</em><br/>
  This is the code:<br/></p>
  
  <pre><code> try{
        Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
        net.sf.jasperreports.engine.util.JRProperties.setProperty("net.sf.jasperreports.query.executer.factory.xmla-mdx", "net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuterFactory");
  
        final Connection connection =
          DriverManager.getConnection(
              "jdbc:xmla:Server=http://localhost/olap/msmdpump.dll"
              + ";Cache=org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache"
              + ";Cache.Name=MyNiftyConnection"
              + ";Cache.Mode=LFU;Cache.Timeout=600;Cache.Size=100"
              + ";Catalog=Test"
              ,null, null);
  
      OlapWrapper wrapper = (OlapWrapper) connection;
      OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
  
      String fileJrxml = "C:\\report_xmla.jrxml";
  
      HashMap&lt;String,Object&gt; hm_parameters = new HashMap&lt;String, Object&gt;();
  
      JasperDesign jasperDesign = JRXmlLoader.load(fileJrxml);
      JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
  
      JasperPrint jp = null;
  
      jp = JasperFillManager.fillReport(jasperReport, hm_parameters, olapConnection);
  
      // Done
      connection.close();
      } catch (Exception e) {
          System.out.println(e.getMessage());
      }
  </code></pre>
  
  <p>Where am I doing wrong?</p>