ExceptionInInitializerError when querying a collection using querydsl
When executing the following code I get an exception when executing the query/projection. Does anybody know what I am doing incorrectly? All help greatly appreciated.
Data lt = alias(Data.class,"Data");
for(String location: from 开发者_C百科($(lt),Arrays.asList(allData.toArray())).list($(lt.getData()))){
System.out.println(location);
}
The Exception I get is as follows:
Exception in thread "main" java.lang.ExceptionInInitializerError at com.mysema.query.collections.MiniApi.(MiniApi.java:22)... etc.
Caused by: java.lang.NullPointerException at com.mysema.codegen.EvaluatorFactory.(EvaluatorFactory.java:51) at com.mysema.query.collections.ExprEvaluatorFactory.(ExprEvaluatorFactory.java:55) at com.mysema.query.collections.ExprEvaluatorFactory.(ExprEvaluatorFactory.java:50) at com.mysema.query.collections.ExprEvaluatorFactory.(ExprEvaluatorFactory.java:32) ... 4 more
Make sure that the Data class has an empty constructor. I am currently on vacation and don't have the sources to investigate the stacktrace further, but adding the empty constructor would be my first thing to try.
The alias feature of Querydsl generates dynamic subclasses, and this fails for classes without an empty non-private constructor.
精彩评论