The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

hk108 (1) [Avatar] Offline
#1
i'm trying to compile below code i have included all the jar files but still i'm getting error plz someone help me to resolve this problem

error
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.NoSuchFieldError: MONETDB
at mondrian.spi.impl.MonetDbDialect.<clinit>(MonetDbDialect.java:2smilie
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unknown Source)
at sun.reflect.ReflectionFactory.newFieldAccessor(Unknown Source)
at java.lang.reflect.Field.acquireFieldAccessor(Unknown Source)
at java.lang.reflect.Field.getFieldAccessor(Unknown Source)
at java.lang.reflect.Field.get(Unknown Source)
at mondrian.spi.DialectManager.createFactoryForDialect(DialectManager.java:129)
at mondrian.spi.DialectManager$DialectManagerImpl.<init>(DialectManager.java:179)
at mondrian.spi.DialectManager.<clinit>(DialectManager.java:34)
at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:233)
at mondrian.rolap.RolapSchema.<init>(RolapSchema.java:18smilie
at mondrian.rolap.RolapSchemaUpgrader.upgrade(RolapSchemaUpgrader.java:100)
at mondrian.rolap.RolapSchemaLoader.loadStage0(RolapSchemaLoader.java:220)
at mondrian.rolap.RolapSchemaLoader.createSchema(RolapSchemaLoader.java:3699)
at mondrian.rolap.RolapSchemaPool.get(RolapSchemaPool.java:211)
at mondrian.rolap.RolapSchemaPool.get(RolapSchemaPool.java:63)
at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:163)
at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:91)
at mondrian.olap.DriverManager.getConnection(DriverManager.java:112)
at mondrian.olap.DriverManager.getConnection(DriverManager.java:6smilie
at mondrian.olap4j.MondrianOlap4jConnection.<init>(MondrianOlap4jConnection.java:153)
at mondrian.olap4j.FactoryJdbc4Plus$AbstractConnection.<init>(FactoryJdbc4Plus.java:323)
at mondrian.olap4j.FactoryJdbc41Impl$MondrianOlap4jConnectionJdbc41.<init>(FactoryJdbc41Impl.java:11smilie
at mondrian.olap4j.FactoryJdbc41Impl.newConnection(FactoryJdbc41Impl.java:32)
at mondrian.olap4j.MondrianOlap4jDriver.connect(MondrianOlap4jDriver.java:137)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MondrianDriverConnectDemo.main(MondrianDriverConnectDemo.java:25)


this is the code i'm compiling

import java.sql.Connection;
import java.sql.DriverManager;

import org.olap4j.OlapConnection;

public class MondrianDriverConnectDemo {

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

// Load the driver
Class.forName("mondrian.olap4j.MondrianOlap4jDriver");

// Connect
String cnxURL =
"jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/foodmart;" +
"JdbcDrivers=com.mysql.jdbc.Driver;" +
"JdbcUser=root;" +
"JdbcPassword=;" +
"Catalog=file://c:/FoodMart.xml;";
// Catalog

// We are dealing with an olap connection. we must unwrap it.
Connection connection = DriverManager.getConnection(cnxURL);
OlapConnection olapConnection = connection.unwrap(OlapConnection.class);
// Check if it's all groovy
System.out.println(
olapConnection.getMetaData().getDriverName()
+ " -> "
+ olapConnection.getMetaData().getDatabaseProductName()
+ " version " + olapConnection.getMetaData().getDatabaseMajorVersion()
+ "." + olapConnection.getMetaData().getDatabaseMinorVersion());

// Done
connection.close();
}

}