javassasolapolap4j

AssertionError on Olap4j with SSAS 2012


We are trying to run a OLAP query with olap4j against SSAS. I've managed to setup the XML/A endpoint, and SSMS connects to the endpoint correctly and works fine.

However each time I try to run a query from JAVA it fails.

Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");

Connection connection = DriverManager.getConnection(
          "jdbc:xmla:Server=http://servername/msmdpump.dll;Catalog=DatabaseName");
OlapWrapper wrapper = (OlapWrapper) connection;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);

CellSet set = olapConnection.createStatement().executeOlapQuery(
        "SELECT [Measures].[Foo] ON COLUMNS, " +
        "[Dimension].[Id].[All].children ON ROWS FROM [Cube]");

The exception/stacktrace:

java.lang.AssertionError
    at org.olap4j.driver.xmla.XmlaOlap4jElement.<init>(XmlaOlap4jElement.java:43)
    at org.olap4j.driver.xmla.XmlaOlap4jProperty.<init>(XmlaOlap4jProperty.java:54)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection$PropertyHandler.handle(XmlaOlap4jConnection.java:1890)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:854)
    at org.olap4j.driver.xmla.DeferredNamedListImpl.populateList(DeferredNamedListImpl.java:136)
    at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:90)
    at org.olap4j.driver.xmla.DeferredNamedListImpl.size(DeferredNamedListImpl.java:116)
    at java.util.AbstractCollection.toArray(Unknown Source)
    at java.util.ArrayList.addAll(Unknown Source)
    at org.olap4j.driver.xmla.XmlaOlap4jLevel.getProperties(XmlaOlap4jLevel.java:189)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection$MemberHandler.addUserDefinedDimensionProperties(XmlaOlap4jConnection.java:1739)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection$MemberHandler.handle(XmlaOlap4jConnection.java:1698)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:854)
    at org.olap4j.driver.xmla.XmlaOlap4jCube$RawMetadataReader.lookupMemberRelatives(XmlaOlap4jCube.java:547)
    at org.olap4j.driver.xmla.XmlaOlap4jCube$RawMetadataReader.lookupMemberByUniqueName(XmlaOlap4jCube.java:438)
    at org.olap4j.driver.xmla.XmlaOlap4jCube$DelegatingMetadataReader.lookupMemberByUniqueName(XmlaOlap4jCube.java:252)
    at org.olap4j.driver.xmla.XmlaOlap4jCube$CachingMetadataReader.lookupMemberByUniqueName(XmlaOlap4jCube.java:338)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection$MeasureHandler.handle(XmlaOlap4jConnection.java:1555)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:854)
    at org.olap4j.driver.xmla.XmlaOlap4jCube.<init>(XmlaOlap4jCube.java:110)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection$CubeHandler.handle(XmlaOlap4jConnection.java:1284)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:854)
    at org.olap4j.driver.xmla.DeferredNamedListImpl.populateList(DeferredNamedListImpl.java:136)
    at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:90)
    at org.olap4j.driver.xmla.DeferredNamedListImpl.size(DeferredNamedListImpl.java:116)
    at java.util.AbstractList$Itr.hasNext(Unknown Source)
    at org.olap4j.driver.xmla.XmlaOlap4jCellSet.lookupCube(XmlaOlap4jCellSet.java:520)
    at org.olap4j.driver.xmla.XmlaOlap4jCellSet.createMetaData(XmlaOlap4jCellSet.java:403)
    at org.olap4j.driver.xmla.XmlaOlap4jCellSet.populate(XmlaOlap4jCellSet.java:181)
    at org.olap4j.driver.xmla.XmlaOlap4jStatement.executeOlapQuery(XmlaOlap4jStatement.java:372)
    at com.socgen.moma.services.pricingassetscope.DefaultPricingAssetScopeManagerTest.testOlap4j(DefaultPricingAssetScopeManagerTest.java:184)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
    14:17

Solution

  • For some reason, the code tries to build an XMLA element with a null unique name.

    XmlaOlap4jElement(
        String uniqueName,
        String name,
        String caption,
        String description)
    {
        assert uniqueName != null;
    

    Try sniffing the messages coming out of SSAS. There's probably something funky with the XML it returns.

    Alternatively, you can take the high road and turn off assertions, but this error is a sign that something terribly wrong is going on and I recommend against this approach.