使用SSAS 2012的Olap4j上的AssertionError

时间:2015-05-26 06:24:53

标签: java ssas olap olap4j

我们正在尝试使用olap4j针对SSAS运行OLAP查询。我已设法设置XML / A端点,SSMS正确连接到端点并正常工作。

然而,每当我尝试从JAVA运行查询时,它都会失败。

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]");

异常/ 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

1 个答案:

答案 0 :(得分:1)

由于某种原因,代码尝试使用null唯一名称构建XMLA元素。

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

尝试嗅探SSAS发出的消息。它返回的XML可能有点时髦。

或者,您可以走高端路线并关闭断言,但这个错误表明发生了一些非常错误的事情,我建议不要这样做。