PDA

View Full Version : NullPointerException (MondrianDef$Table.find)



ewiltshi
11-18-2003, 10:30 AM
Hi all,
Versions: Tomcat 5, Windows 2000 Server, Mondrian 1.0.1, JPivot 1.0.2, MS SQL Server (using JTDS JDBC driver).
I am getting the following exception any time I include a level that is based on a KeyExpression (see this below stacktrace). All the data comes from ONE massive fact table, but certain fields need to be expanded from a single character or integer field to a string (i.e. 'W' --> 'Web'). This worked using Mondrian 0.5, using ExpressionView tags instead of KeyExpression. I could create a star schema, but would rather use 'case when' expressions. What am I doing wrong?
Thanks!
StackTrace:
java.lang.NullPointerException
mondrian.olap.MondrianDef$Table.find(MondrianDef.java:1493)
mondrian.rolap.HierarchyUsage.setJoinTable(HierarchyUsage.java:115)
mondrian.rolap.HierarchyUsage.init(HierarchyUsage.java:93)
mondrian.rolap.RolapHierarchy.init(RolapHierarchy.java:142)
mondrian.rolap.RolapDimension.init(RolapDimension.java:119)
mondrian.rolap.RolapCube.init(RolapCube.java:174)
mondrian.rolap.RolapCube.(RolapCube.java:76)
mondrian.rolap.RolapSchema.load(RolapSchema.java:115)
mondrian.rolap.RolapSchema.(RolapSchema.java:93)
mondrian.rolap.RolapSchema.(RolapSchema.java:34)
mondrian.rolap.RolapSchema$Pool.get(RolapSchema.java:249)
mondrian.rolap.RolapConnection.(RolapConnection.java:89)
mondrian.rolap.RolapConnection.(RolapConnection.java:60)
mondrian.olap.DriverManager.getConnection(DriverManager.java:133)
mondrian.olap.DriverManager.getConnection(DriverManager.java:49)
com.tonbeller.jpivot.mondrian.MondrianModel.initialize(MondrianModel.java:241)
com.tonbeller.jpivot.olap.model.OlapModelDecorator.initialize(OlapModelDecorator.java:152)
com.tonbeller.jpivot.olap.model.OlapModelProxy.setDelegate(OlapModelProxy.java:84)
com.tonbeller.jpivot.olap.model.OlapModelProxy.setOlapModel(OlapModelProxy.java:73)
com.tonbeller.jpivot.olap.OlapModelTag.doAfterBody(OlapModelTag.java:74)
org.apache.jsp.dateTest_jsp._jspx_meth_jp_mondrianQuery_0(dateTest_jsp.java:124)
org.apache.jsp.dateTest_jsp._jspService(dateTest_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
from by cube.xml:

<dimension name="Channel">
<hierarchy hasAll="true" allMemberName="Channels">
<level name="Channel" uniqueMembers="false">
<KeyExpression>
<SQL dialect="generic">
( case when channel = 'W' then 'Web'
when channel = 'P' then 'Phone'
else 'Unknown' end )
</SQL>
</KeyExpression>
</level>
</hierarchy>
</dimension>

ewiltshi
11-18-2003, 10:50 AM
Ok, I figured it out myself. Changing my levels to the following worked (from KeyExpression with no column, to a specific column and NameExpression):

<dimension name="Channel">
<hierarchy hasAll="true" allMemberName="Channels">
<level name="Channel" uniqueMembers="false" column="channel">
<NameExpression>
<SQL dialect="generic">
( case when channel = 'W' then 'Web'
when channel = 'P' then 'Phone'
else 'Unknown' end )
</SQL>
</NameExpression>
</level>
</hierarchy>
</dimension>
Thanks anyway! :)