Hi All,
I had the same error as the guys from the old mailing list
"java.lang.NoClassDefFoundError: Could not initialize class
net.hydromatic.optiq.jdbc.Driver"
(https://groups.google.com/forum/#!topic/optiq-dev/RiPFdBstVag) and indeed the
problem was as someone notice from the UnregisteredDriver.java file, to be more
precise:
protected static AvaticaFactory instantiateFactory(String factoryClassName) {
try {
final Class<?> clazz = Class.forName(factoryClassName);
return (AvaticaFactory) clazz.newInstance();
} catch (ClassNotFoundException e) {
logger.error(e);
} catch (IllegalAccessException e) {
logger.error(e);
} catch (InstantiationException e) {
logger.error(e);
} catch (Exception e) {
logger.error(e);
}
return null;
}
(I modified a bit the code and I used something like:
private static org.apache.log4j.Logger logger =
org.apache.log4j.Logger.getLogger(UnregisteredDriver.class);
to see the logs in Tomcat)
And it was failing without any error message. This was voodoo! And then I got
the idea to add a new catch at the end:
catch(Throwable t) {
logger.error(t);
}
And indeed, I catch a 'Throwable' and it was failing because of a missing
class; some of the maven dependencies weren't in the Tomcat path and long story
short I added the following jars in the 'tomcat/webapps/saiku/WEB-INF/lib/'
file:
- linq4j-0.4.jar
- commons-compiler-2.7.3.jar
- guava-18.0-rc1.jar
- jackson-annotations-2.3.0.jar
- jackson-core-2.3.0.jar
- jackson-databind-2.1.1.jar
- janino-2.7.3.jar
- mongo-java-driver-2.11.1.jar
Then everything was working, Saiku was connected the mongodb database, but
Mondrian creates queries like (I omitted the GROUP BY part):
select "zips"."city" as "c0" from "zips" as "zips" group by "zips"."city";
And Optiq doesn't validate queries with quotes (queries like: 'select zips.city
as c0 from zips as zips group by zips.city' are executed), and since I was
using Mondrian 3.7 I couldn't use '<Schema name="Mongo_Test"
quoteSql="false">', so I looked for a way to make Optiq ignore the quotes and I
found that the problem was a flag 'caseSensitive' used in different classes
(PlannerImpl.java, InternalProperty.java) and the problem started in
OptiqCatalogReader class in validating table/columns names functions
('getTable', 'field').
And since I was pressured by the time to investigate if I can use Mondrian with
Mongodb and check the performance I hardcoded caseSensitive to false and it
worked, I run a MDX query in Saiku against a mongodb test database (the famous
'zips' collection).
Regards,
Ionut