i am trying to connect to mondrian and trying to execute MDX queries but i am facing some exceptions which i am unable to resolve.
Following is my code.Can anyone help me out with this.it's little urgent!!
thank you in advance!!!



import java.util.*;
import java.sql.*;


import org.olap4j.*;
import org.olap4j.metadata.*;


public class OlapTest {


public static void main(String args[]) throws Exception {


Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
// Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
Connection test = DriverManager.getConnection(
"jdbc:mondrian:" +"Jdbc=jdbc:mysql://localhost:3306/foodmart?user=root&password=root;" +

"JdbcDrivers=com.mysql.jdbc.Driver;" +
"Catalog= C://Documents and Settings//Administrator.SYS28//My Documents//Downloads//mondrian-3.4.1//demo//FoodMart.xml;");
OlapConnection connection = ((OlapWrapper)test).unwrap(OlapConnection.class);

OlapWrapper wrapper = (OlapWrapper) connection;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
OlapStatement statement = olapConnection.createStatement();


CellSet result = statement.executeOlapQuery("select {[Measures]} on columns, {[Date].[All years]} on rows from [events]");


for (CellSetAxis axis : result.getAxes()) {
System.out.print(axis.getAxisOrdinal() + ": ");
boolean firstPos = true;
for (Position position : axis.getPositions()) {
if (!firstPos) {
System.out.print(", ");
}
System.out.print("{");
boolean first = true;
for (Member member : position.getMembers()) {
if (!first) {
System.out.print(", ");
}
System.out.print(member.getUniqueName());
first = false;
}
System.out.print("}");
firstPos = false;
}
System.out.println("");
}


// Finally, display the Cells
CellSetAxis cols = result.getAxes().get(0);
CellSetAxis rows = result.getAxes().get(1);
for (int row = 0; row < rows.getPositions().size(); row++) {
System.out.println("Row #" + (row + 1) + ":");
for (int col = 0; col < cols.getPositions().size(); col++) {
List<Integer> positions = new ArrayList<Integer>(2);
positions.add(col);
positions.add(row);
Cell cell = result.getCell(positions);
System.out.println(cell.getFormattedValue());
}
}
}
}



Output: Exceptions

log4j:WARN No appenders could be found for logger (mondrian.olap.MondrianProperties).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ReferenceMap
at mondrian.rolap.agg.SegmentCacheManager$SegmentCacheIndexRegistry.<init>(SegmentCacheManager.java:1510)
at mondrian.rolap.agg.SegmentCacheManager.<init>(SegmentCacheManager.java:256)
at mondrian.rolap.agg.AggregationManager.<init>(AggregationManager.java:58)
at mondrian.server.MondrianServerImpl.<init>(MondrianServerImpl.java:172)
at mondrian.server.MondrianServerRegistry.createWithRepository(MondrianServerRegistry.java:184)
at mondrian.server.MondrianServerRegistry.<init>(MondrianServerRegistry.java:48)
at mondrian.server.MondrianServerRegistry.<clinit>(MondrianServerRegistry.java:33)
at mondrian.olap.MondrianServer.forId(MondrianServer.java:77)
at mondrian.olap.DriverManager.getConnection(DriverManager.java:98)
at mondrian.olap.DriverManager.getConnection(DriverManager.java:68)
at mondrian.olap4j.MondrianOlap4jConnection.<init>(MondrianOlap4jConnection.java:135)
at mondrian.olap4j.FactoryJdbc4Plus$AbstractConnection.<init>(FactoryJdbc4Plus.java:323)
at mondrian.olap4j.FactoryJdbc41Impl$MondrianOlap4jConnectionJdbc41.<init>(FactoryJdbc41Impl.java:118)
at mondrian.olap4j.FactoryJdbc41Impl.newConnection(FactoryJdbc41Impl.java:32)
at mondrian.olap4j.MondrianOlap4jDriver.connect(MondrianOlap4jDriver.java:132)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at OlapTest.main(OlapTest.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.map.ReferenceMap
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 18 more