NullPointerException on fillReport in Java with XML-A datasource (Olap)

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.

I have a Java service that I generates reports with the JasperReports 4.0.5 library. It works well with standard JDBC datasource.
Now I am trying to run it on olap datasource, then connecting me to a XML-A server. In the design phase with iReport, everything runs, but when I run it in Java, I get an error "NullPointerException" on execution!
I's using olap4j library to connect to the data source, the same one used by iReport
This is the 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://serverdb/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 = "I:\\Work\\prod_ireport\\olap2.jrxml";
 
    HashMap<String,Object> hm_parameters = new HashMap<String, Object>();
 
    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());
    }

Where am I doing wrong?

tonyf-dj's picture
Joined: Jul 15 2013 - 3:03am
Last seen: 7 years 11 months ago

1 Answer:

Is there anyone?

tonyf-dj's picture
Joined: Jul 15 2013 - 3:03am
Last seen: 7 years 11 months ago
Feedback
randomness