我在mondrian和sql server的幫助下構建了一個模式文件。Mondrian Olap ClassNotFoundException:mondrian.olap4j.MondrianOlap4jDriver
現在我正在使用olap4j編寫數據庫連接的Java代碼。
代碼是:
try {
Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
String connectionString1 = "type=OLAP name=sales driver=mondrian.olap4j.MondrianOlap4jDriver location=jdbc:mondrian:Jdbc=jdbc:sqlserver://serverName:1433;database=TempDatabase;Catalog=C:/Schema1.xml;JdbcDrivers=com.microsoft.sqlserver.jdbc.SQLServerDriver username=sa [email protected]";
Connection jdbcConnection = DriverManager.getConnection(connectionString1);
OlapConnection connection = ((OlapWrapper)jdbcConnection).unwrap(OlapConnection.class);
OlapStatement olapStatement = connection.createStatement();
} catch (SQLException e) {
e.printStackTrace();
}catch (ClassNotFoundException e) {
e.printStackTrace();
}
但是,這是給我的錯誤,同時運行代碼:
java.lang.ClassNotFoundException: mondrian.olap4j.MondrianOlap4jDriver
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.tuto.Test.main(Test.java:16)
我使用下列jar:
1.asm.jar
2.asm-commons.jar
3.asm-tree.jar
4.javacup.jar
5.olap4j-1.0.0.445.jar
6.olap4j-xmla-1.0.0.445.jar
7.retroweaver.jar
8.retroweaver-rt.jar
9.sqljdbc.jar
10.xercesImpl.jar
11.olap4j-tck-1.0.0.445.jar
請幫我爲什麼我得到這個錯誤?
謝謝。