Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Need to develop a client java app that can connect to Mondrian server

  1. #1
    Join Date
    Jun 2013

    Question Need to develop a client java app that can connect to Mondrian server


    I am new to Mondrian and working on developing a java client that can connect to Mondrian server (Mondrian version 3.5.x) and execute query. I am using olap4j.jar and referring to a PDF 'Olap4j_Introduction_An_end_user_perspective.pdf' for writing java client. The code that I have written so far is as follows:

    package test;
    import mondrian.olap.Connection;
    import mondrian.olap.DriverManager;
    import mondrian.spi.impl.CatalogLocatorImpl;

    public class InvokeMondrianXMLA {
    public static void main(String[] args) throws Exception {
    Connection connection = DriverManager.getConnection("jdbc:xmla:"
    + "Server=http://localhost:8080/mondrian/xmla;Catalog=SM2;DataSource=DynamicUpdateTest",
    new CatalogLocatorImpl());

    I get following exception:

    Exception in thread "main" mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while looking up data source (DynamicUpdateTest)
    at mondrian.resource.MondrianResource$_Def0.ex(
    at mondrian.olap.Util.newInternal(
    at mondrian.rolap.RolapConnection.createDataSource(
    at mondrian.rolap.RolapConnection.<init>(
    at mondrian.rolap.RolapConnection.<init>(
    at mondrian.olap.DriverManager.getConnection(
    at mondrian.olap.DriverManager.getConnection(
    at mondrian.olap.DriverManager.getConnection(
    at test.InvokeMondrianXMLA.main(
    Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at mondrian.spi.impl.JndiDataSourceResolver.lookup(
    at mondrian.rolap.RolapConnection.createDataSource(
    ... 6 more

    Can somebody help me?

    ~ Reshma

  2. #2
    Join Date
    Jan 2013


    The error indicates the DataSource isn't found. You could try leaving off the Catalog and DataSource from the connection string. Then (assuming the connection succeeds), you can check what databases and catalogs are available with

    OlapConnection olapConnection = connection.unwrap(OlapConnection.class);

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2017 Pentaho Corporation. All Rights Reserved.