You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Kevan Miller (JIRA)" <ji...@apache.org> on 2011/06/29 06:45:28 UTC

[jira] [Created] (OPENJPA-2024) IllegalStateException: localized message key: meta-field-not-param

IllegalStateException: localized message key: meta-field-not-param
------------------------------------------------------------------

                 Key: OPENJPA-2024
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2024
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.1.0
            Reporter: Kevan Miller


Geronimo testing (currently on 2.1.0) has turned up the following problem:

java.lang.IllegalStateException: localized message key: meta-field-not-param; substitutions: [class com.foo.Baz_, serialVersionUID, long]
       at org.apache.openjpa.persistence.meta.MetamodelImpl.getParameterziedType(MetamodelImpl.java:341)
       at org.apache.openjpa.persistence.meta.MetamodelImpl.populate(MetamodelImpl.java:310)
       at org.apache.openjpa.persistence.meta.MetamodelImpl.instantiate(MetamodelImpl.java:257)
       at org.apache.openjpa.persistence.meta.MetamodelImpl.find(MetamodelImpl.java:226)
       at org.apache.openjpa.persistence.meta.MetamodelImpl.<init>(MetamodelImpl.java:91)
       at org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:346)
       at org.apache.openjpa.persistence.EntityManagerFactoryImpl.getCriteriaBuilder(EntityManagerFactoryImpl.java:333)
       at org.apache.openjpa.persistence.EntityManagerImpl.getCriteriaBuilder(EntityManagerImpl.java:1638)
       at org.apache.openjpa.persistence.EntityManagerImpl.getCriteriaBuilder(EntityManagerImpl.java:101)
       at com.foo.Test.query(Test.java:xxx)

serialVersionUID is a synthetic field added by new Aries Proxy/Weaving code. I'm pretty confident that their weaving is the cause of this error. Is it possible to ignore synthetic method? Or can you provide some additional information about the cause of this exception?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] [Created] (OPENJPA-2024) IllegalStateException: localized message key: meta-field-not-param

Posted by Kevan Miller <ke...@gmail.com>.
Thanks for the great info. Will be pinging the Aries folks about checking for the annotation and skipping the metamodel classes, but even if they do -- it may be wise to update OpenJPA, also...

On Jun 29, 2011, at 12:31 PM, Pinaki Poddar wrote:

> To help me to understand the problem better, please elaborate/answer the
> following:
> 
> a) Is the original persistent domain classes compiled with
> -Aopenjpa.metamodel=true option?

No. It was generated by EclipseLink, not OpenJPA.

> b) If yes, please post generated com.foo.Baz_.java and original
> com.foo.Baz.java.

com.foo.Baz are names that I made up. I can't share the actual source. However, I'm thinking that this basic error would occur with any metamodel classes. 

> c) If not, what is the origin of com.foo.Baz_ ?

EclipseLink model generator.

> d)  If possible, post the original declaration of serialversionUID in its
> owning class

There isn't a serialVersionUID declaration. It's all added dynamically at runtime by new Aries proxy/weaving code. 

--kevan


Re: [jira] [Created] (OPENJPA-2024) IllegalStateException: localized message key: meta-field-not-param

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
> Or can you provide some additional information about the cause of this
> exception? 

The exception is caused when fields of a metamodel class are being assigned
a value. The metamodel classes are generated as source code during
compilation with a specialized annotation processor. The generated source
declares a set of static fields whose types are
javax.persistence.meamodel.Attribute. This mechanics is to address the lack
of type literals in Java language. At runtime, metamodel is instantiated and
values are assigned to its fields. The breakage you are seeing is during
this assignment process. OpenJPA code is seeing a field named
'serialVersionUID' in com.foo.Baz_, expecting its type to be
javax.persistence.meamodel.Attribute (or its subtype) and getting very
confused because it is not.

If the weaving process synthesizes a serialVersionUID field to every class,
then one option for the process to be aware of these metamodel classes and
ignore them from being weaved. The signature carries a
@javax.persistence.meamodel.StaticMetamodel annotation for the weaving
process to identify them.

So, introduction of a new synthetic field in com.foo.Baz_ has essentially
turned it into a 'non-canonical' metamodel class. The JPA spec has allowed
non-canonical metamodel classes, but been explicit about the vendors not
supporting it. 

The other option is OpenJPA be aware of such synthetic field and ignore them
during population of metamodel. I think that is possible especially for a
field as typical as serialVersionUID.
   

To help me to understand the problem better, please elaborate/answer the
following:
 
a) Is the original persistent domain classes compiled with
-Aopenjpa.metamodel=true option?
b) If yes, please post generated com.foo.Baz_.java and original
com.foo.Baz.java.
c) If not, what is the origin of com.foo.Baz_ ?
d)  If possible, post the original declaration of serialversionUID in its
owning class  


-----
Pinaki 
--
View this message in context: http://openjpa.208410.n2.nabble.com/jira-Created-OPENJPA-2024-IllegalStateException-localized-message-key-meta-field-not-param-tp6527720p6529735.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.