Question

mondrian.olap.Schema.createCube(xml) in java get error when I add DimesionUsage to Xml

I create myXML.xml :

<Cube cache="false" caption="" enabled="true" name="Deposit,LC,Loan">
 <View alias="virtualCube">
  <SQL dialect="generic">
  " some SQL query "
  </SQL>
 </View>
 <DimensionUsage foreignKey="FD_BRANCH" name="Branch" source="Branch"/>
 <DimensionUsage foreignKey="FD_CLOSEDATE" name="Date" source="Date"/>
 <DimensionUsage foreignKey="FD_CURRENCY" name="Currency" source="Currency"/>
 <Measure aggregator="sum" caption="" column="CNT" name="Count"/>
 <Measure aggregator="sum" caption="" column="ACCOUNT" name="AccAmount"/>
</Cube>

But when I call mondrian.olap.Schema.createCube(myXML) it gives me below error:

Exception in thread "main" java.lang.NullPointerException
at mondrian.olap.MondrianDef$DimensionUsage.getDimension(MondrianDef.java:990)
at mondrian.rolap.RolapCube.getOrCreateDimension(RolapCube.java:778)
at mondrian.rolap.RolapCube.<init>(RolapCube.java:197)
at mondrian.rolap.RolapCube.<init>(RolapCube.java:228)
at mondrian.rolap.RolapSchema.createCube(RolapSchema.java:847)

EDIT

This error happens just for "Branch" because it have more than one hierarchy in, but it worked correctly for other cube in Mondrian Schema.

Does anybody know why?

Was it helpful?

Solution

It was the bug of Mondrian ...

my "Branch" dimension has more than one hierarchy but others doesn't have.

The solution is :

DimensionUsage foreignKey="FD_BRANCH" name="Branch.hierarchyName" source="Branch"/>

for those have more than one hierarchy should do like this and It'll work perfectly!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top