Can I ask why the multiple classloaders? Historically OpenJPA has been temperamental when you start touching classloaders.
Thanks, Rick On Sat, Jul 14, 2012 at 9:44 AM, garpinc <garp...@yahoo.com> wrote: > 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. > > -- *Rick Curtis*