when i try to connect the SSAS cube using the olap4j drivers,this exception just came out,and search the internet ,just cannot get any information! the exception output just as below:
Exception in thread "main" java.lang.NoClassDefFoundError: com/rc/retroweaver/runtime/Collections
at org.olap4j.driver.xmla.XmlaOlap4jDriver.<clinit>(XmlaOlap4jDriver.java:338)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at cn.lds.olap.T.getConnection(T.java:19)
at cn.lds.olap.T.main(T.java:30)
Caused by: java.lang.ClassNotFoundException: com.rc.retroweaver.runtime.Collections
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)
... 5 more
And this is my java code: package cn.lds.olap;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.olap4j.Cell;
import org.olap4j.CellSet;
import org.olap4j.OlapConnection;
import org.olap4j.OlapStatement;
import org.olap4j.OlapWrapper;
import org.olap4j.Position;
import org.olap4j.metadata.Member;
public class T {
public static Connection getConnection() {
Connection connection = null;
try {
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
connection = DriverManager
.getConnection("jdbc:xmla:Server=http://localhost/olap/msmdpump.dll;Catalog=CubeOne");
} catch (Exception e) {
e.printStackTrace();
}
return connection;
}
public static void main(String[] args) {
try {
Connection connection = getConnection();
OlapWrapper wrapper = (OlapWrapper) connection;
OlapConnection olapConnection = wrapper
.unwrap(OlapConnection.class);
OlapStatement statement = (OlapStatement) connection
.createStatement();
CellSet cellSet = statement
.executeOlapQuery("SELECT {[Measures].[Unit Sales]} ON COLUMNS,\n"
+ " {[Product].Members} ON ROWS\n"
+ "FROM [Adventure Works DW2012]");
for (Position row : cellSet.getAxes().get(1)) {
for (Position column : cellSet.getAxes().get(0)) {
for (Member member : row.getMembers()) {
System.out.println(member.getUniqueName());
}
for (Member member : column.getMembers()) {
System.out.println(member.getUniqueName());
}
final Cell cell = cellSet.getCell(column, row);
System.out.println(cell.getFormattedValue());
System.out.println();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
I use the jdk1.6.0_45,and the version of olap4j is 1.1.0.
My bet is that you have both olap4j and olap4j-jdk14 in your classpath. Remove olap4j-jdk14, since this is only required for JVM of 1.4 and below. You can't use both at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With