openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garpinc <garp...@yahoo.com>
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(),
anno.value()).getMessage()); 
        } 

cls and anno.value() toStrings both show: class
com.cambridgesemantics.anzo.relationalreplicator.ontologies1.film.MoviePersonMetadata 

but the ids are different and 
org.apache.openjpa.enhance.PersistenceCapable.class.isAssignableFrom(cls) is
true 
org.apache.openjpa.enhance.PersistenceCapable.class.isAssignableFrom(anno.value())
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 PCEnhancer.run(ojc, 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
classes. 

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


Thanks. 

--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-metamodel-problem-with-multiple-classloaders-tp7580606.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message