openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garpinc <>
Subject openjpa.metamodel problem with multiple classloaders
Date Sat, 14 Jul 2012 14:44:01 GMT
in 2.2.0 
I got this exception thrown in MetaModelImpl.class 

        if (cls != anno.value()) { 
            throw new IllegalStateException(_loc.get("meta-class-mismatch", 
                    mcls.getName(), cls.getName(),

cls and anno.value() toStrings both show: class 

but the ids are different and 
org.apache.openjpa.enhance.PersistenceCapable.class.isAssignableFrom(cls) is
is false 

The sequence of annotate and enhance are as follows: 
1) I'm dynamically compiling my classes to classloader1 using following line
and compilation option -Aopenjpa.metamodel=true 
        boolean status = compiler.getTask(null, fileManager, diagnostics,
compilationOptions, null, jfiles).call(); 

2) then I pass this classloader1 in to the constructor of dynamic
classloader2 which is able to receive class bytes from enhancer writer 
3) then I call, eargs, eflags, null, writer,
classLoader1) with the writer writing to classloader2 
4) I then use classloader2 to do all my work and this works until I try to
use CriteriaBuilder which results the the above exception being thrown. 
5) If I remove -Aopenjpa.metamodel=true then critera works but then i can't
use metamodel 

On debug I see that AnnotationProcessor6 is where the anno.value()'s are
populated from but some how the classes there don't match the compiled

Does anyone have any ideas on how i can get this to work? 


View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message