openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "roger.keays" <roger.ke...@ninthavenue.com.au>
Subject Re: Shared classloader and subclasses
Date Tue, 20 Mar 2007 22:24:08 GMT



Abe White wrote:
> 
>> AFIACT, the problem is that the openjpa.enhance.PCRegistry class  
>> uses static
>> fields to store Meta information. When the second instance is  
>> loaded, the
>> PCRegistry has been initialized, but doesn't contain that instance's
>> subclasses and an exception is thrown
> 
> The PCRegistry has to use static members because each persistent  
> class registers itself with the registry in its static initializer.   
> There is no way for a persistent class to access a specific registry  
> instance when it is loaded into the JVM.
> 
> I don't think the proposed patch is viable, because there are cases  
> where we lazily-load metadata, and we don't want to leave out  
> subclasses just because we haven't parsed their metadata yet.  What  
> is the exception you're seeing?
> 
<4|true|0.9.6-incubating> org.apache.openjpa.persistence.ArgumentException:
No m
etadata was found for type "class figbird.forums.entities.Topic". The class
does
 not appear in the list of persistent types:
[figbird.lists.entities.Newsletter,
 figbird.lists.entities.MailingList, mlynch.entities.Flyer,
figbird.cms.entities
.File, figbird.lists.entities.Email, figbird.cms.entities.News,
figbird.cms.enti
ties.Blob, figbird.cms.entities.IFrame, figbird.cms.entities.Redirect,
figbird.c
ms.entities.Article, figbird.cms.entities.Comment,
figbird.cms.entities.Fragment
, figbird.cms.entities.Content, figbird.lists.entities.Delivery,
figbird.cms.ent
ities.Privilege, figbird.cms.entities.Page].
        at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataReposi
tory.java:278)
        at
org.apache.openjpa.meta.ClassMetaData.getPCSubclassMetaDatas(ClassMet
aData.java:337)
        at
org.apache.openjpa.meta.ClassMetaData.getMappedPCSubclassMetaDatas(Cl
assMetaData.java:351)
        at
org.apache.openjpa.jdbc.meta.ClassMapping.getMappedPCSubclassMappings
(ClassMapping.java:575)
        at
org.apache.openjpa.jdbc.meta.ClassMapping.getIndependentAssignableMap
pings(ClassMapping.java:614)
        at
org.apache.openjpa.jdbc.meta.ValueMappingImpl.getIndependentTypeMappi
ngs(ValueMappingImpl.java:345)
        at
org.apache.openjpa.jdbc.meta.FieldMapping.getIndependentTypeMappings(
FieldMapping.java:964)
        at
org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.supportsSel
ect(RelationFieldStrategy.java:351)
        at
org.apache.openjpa.jdbc.meta.FieldMapping.supportsSelect(FieldMapping
.java:692)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.createEagerSelects(JD
BCStoreManager.java:928)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.createEagerSelects(JD
BCStoreManager.java:910)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.select(JDBCStoreManag
er.java:876)
        at
org.apache.openjpa.jdbc.sql.SelectImpl.select(SelectImpl.java:762)
        at
org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.select(LogicalUn
ion.java:585)
        at
org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.selectIdentifier
:
        at
org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.select(SelectCo
nstructor.java:263)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.populateSelect(JDBCStor
eQuery.java:265)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.access$000(JDBCStoreQue
ry.java:70)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreQuery$1.select(JDBCStoreQuery
.java:237)
        at
org.apache.openjpa.jdbc.sql.LogicalUnion.select(LogicalUnion.java:280
)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.populateUnion(JDBCStore
Query.java:235)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQ
uery.java:183)
        at
org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.exec
uteQuery(ExpressionStoreQuery.java:672)
        at
org.apache.openjpa.datacache.QueryCacheStoreQuery$QueryCacheExecutor.
executeQuery(QueryCacheStoreQuery.java:305)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:977)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:789)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:759)
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:755)
        at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.jav
a:512)
        at
org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:213)
        at
org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.ja
va:268)
        at figbird.cms.application.DAO.getRootItem(DAO.java:149)
 
In the case above, another webapp has loaded the forums module, causing this
webapp to look for the mappings in that module even though they aren't
available.

I had difficulty trying to figure out how to restrict which subclasses are
'seen'. Ideally I think it'd be done in the MetaDataRepository#register()
method, but no metadata seems to be available at this time.

Thanks for your help,

Roger
-- 
View this message in context: http://www.nabble.com/Shared-classloader-and-subclasses-tf3431312.html#a9582982
Sent from the open-jpa-dev mailing list archive at Nabble.com.


Mime
View raw message