The uncaught error was something like: "ERROR [UnregisteredDriver] 
java.lang.NoClassDefFoundError: net/hydromatic/linq4j/QueryProvider".

Ionut

On Aug 17, 2014, at 6:01 PM, Julian Hyde <[email protected]> wrote:

> Great feedback - thanks for your detective work!
> 
> Do you recall what was the type of the uncaught error? It's not usually
> wise to have a 'catch (Throwable)' clause but you've convinced me that it
> makes sense here.
> 
> I'll also looking into creating an 'optiq-all' jar with all dependencies
> (except adapter-specific dependencies like MongoDB). It would have made
> your job a lot easier.
> 
> I believe that you can add 'caseSensitive=false' to the jdbc:optiq: connect
> string. Then you don't need to change any code.
> 
> Julian
> On Aug 17, 2014 1:19 AM, "Ionut Dobre" <[email protected]> wrote:
> 
>> 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

Reply via email to