Buggy code:
private Log _log = null ; private MetaDataFactory _factory = null ; private InterfaceImplGenerator _implGen = null ; private int _resMode = ( MODE_META ) | ( MODE_MAPPING ) ; private int _sourceMode = ( ( MODE_META ) | ( MODE_MAPPING ) ) | ( MODE_QUERY ) ; private int _validate = ( MetaDataRepository . VALIDATE_META ) | ( MetaDataRepository . VALIDATE_UNENHANCED ) ; private final Collection _registered = new ArrayList ( ) ; private final SortedSet _resolving = new TreeSet ( new MetaDataInheritanceComparator ( ) ) ; private final SortedSet _mapping = new TreeSet ( new MetaDataInheritanceComparator ( ) ) ; private final List _errs = new LinkedList ( ) ; private ListenerList _listeners = new LifecycleEventManager . ListenerList ( 3 ) ; public MetaDataRepository ( ) { } public OpenJPAConfiguration getConfiguration ( ) { } public Log getLog ( ) { } public MetaDataRepository newInstance ( ) { } public MetaDataFactory getMetaDataFactory ( ) { } public void setMetaDataFactory ( MetaDataFactory factory ) { } public int getValidate ( ) { } public void setValidate ( int validate ) { } public void setValidate ( int validate , boolean on ) { } public int getResolve ( ) { } public void setResolve ( int mode ) { } public void setResolve ( int mode , boolean on ) { } public int getSourceMode ( ) { } public void setSourceMode ( int mode ) { } public void setSourceMode ( int mode , boolean on ) { } public synchronized ClassMetaData getMetaData ( Class cls , ClassLoader envLoader , boolean mustExist ) { } public ClassMetaData getMetaData ( String alias , ClassLoader envLoader , boolean mustExist ) { } private ClassMetaData getMetaDataInternal ( Class cls , ClassLoader envLoader ) { } private static String toModeString ( int mode ) { } protected void prepareMapping ( ClassMetaData meta ) { } private void resolve ( ClassMetaData meta ) { } private List resolveMeta ( ClassMetaData meta ) { } private void loadMapping ( ClassMetaData meta ) { } private boolean resolveMapping ( ClassMetaData meta ) { } private List processBuffer ( ClassMetaData meta , SortedSet buffer , int mode ) { } public synchronized ClassMetaData [ ] getMetaDatas ( ) { } public ClassMetaData getCachedMetaData ( Class cls ) { } public ClassMetaData addMetaData ( Class cls ) { } public ClassMetaData addMetaData ( Class cls , int access ) { } protected ClassMetaData newClassMetaData ( Class type ) { } protected ClassMetaData [ ] newClassMetaDataArray ( int length ) { } protected FieldMetaData newFieldMetaData ( String name , Class type , ClassMetaData owner ) { } protected FieldMetaData [ ] newFieldMetaDataArray ( int length ) { } protected ClassMetaData newEmbeddedClassMetaData ( ValueMetaData owner ) { } protected ValueMetaData newValueMetaData ( FieldMetaData owner ) { } protected Order newOrder ( FieldMetaData owner , String name , boolean asc ) { } protected Order newValueOrder ( FieldMetaData owner , boolean asc ) { } protected Order newRelatedFieldOrder ( FieldMetaData owner , FieldMetaData rel , boolean asc ) { } protected Order [ ] newOrderArray ( int size ) { } public boolean removeMetaData ( ClassMetaData meta ) { } public synchronized boolean removeMetaData ( Class cls ) { } public void addDeclaredInterfaceImpl ( ClassMetaData meta , Class iface ) { } synchronized void setInterfaceImpl ( ClassMetaData meta , Class impl ) { } synchronized InterfaceImplGenerator getImplGenerator ( ) { } public ClassMetaData getMetaData ( Object oid , ClassLoader envLoader , boolean mustExist ) { } private void resolveIdentityClass ( Object oid ) { } public ClassMetaData [ ] getImplementorMetaDatas ( Class cls , ClassLoader envLoader , boolean mustExist ) { if ( ( cls == null ) && mustExist ) throw new org . apache . openjpa . util . MetaDataException ( MetaDataRepository . _loc . get ( "no-meta" , cls ) ) ; if ( cls == null ) return EMPTY_METAS ; <START_BUG> processRegisteredClasses ( ) ; <END_BUG> Collection vals = ( ( Collection ) ( _impls . get ( cls ) ) ) ; ClassMetaData meta ; Collection mapped = null ; if ( vals != null ) { synchronized ( vals ) { for ( Iterator itr = vals . iterator ( ) ; itr . hasNext ( ) ; ) { meta = getMetaData ( ( ( Class ) ( itr . next ( ) ) ) , envLoader , true ) ; if ( ( meta . isMapped ( ) ) || ( ( meta . getMappedPCSubclassMetaDatas ( ) . length ) > 0 ) ) { if ( mapped == null ) mapped = new ArrayList ( vals . size ( ) ) ; mapped . add ( meta ) ; } } } } if ( ( mapped == null ) && mustExist ) throw new org . apache . openjpa . util . MetaDataException ( MetaDataRepository . _loc . get ( "no-meta" , cls ) ) ; if ( mapped == null ) return EMPTY_METAS ; return ( ( ClassMetaData [ ] ) ( mapped . toArray ( newClassMetaDataArray ( mapped . size ( ) ) ) ) ) ; } public NonPersistentMetaData getPersistenceAware ( Class cls ) { } public NonPersistentMetaData [ ] getPersistenceAwares ( ) { } public NonPersistentMetaData addPersistenceAware ( Class cls ) { } public boolean removePersistenceAware ( Class cls ) { } public NonPersistentMetaData getNonMappedInterface ( Class iface ) { } public NonPersistentMetaData [ ] getNonMappedInterfaces ( ) { } public NonPersistentMetaData addNonMappedInterface ( Class iface ) { } public boolean removeNonMappedInterface ( Class iface ) { } public synchronized void clear ( ) { } public synchronized Set getPersistentTypeNames ( boolean devpath , ClassLoader envLoader ) { } public synchronized Collection loadPersistentTypes ( boolean devpath , ClassLoader envLoader ) { } private Class classForName ( String name , ClassLoader loader ) { } Collection getPCSubclasses ( Class cls ) { } public void register ( Class cls ) { }

Fix:
loadRegisteredClassMetaData ( envLoader ) ;