users@glassfish.java.net

Re: The type T for the attribute A on the entity class C is not a valid type for a serialized mapping. The attribute type must implement the Serializable interface.

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Mon, 25 Jan 2010 18:42:13 -0500

Thanks Mitesh for the info. I have worked around this issue by
generating Serializable bindings but now am seeing other issues in
EclipseLink.
I am realizing that I should not be in EclipseLink code at all since I
use hibernate JPA provider. Please confirm.

If true then there is something that has changed between GF V3 Prelude
and GF V3 Final that impact which EntityManagerFactory my code creates.
Seems that right now it is creating the one for EclipseLink rather than
for hibernate and that is where all my problems seem to be originating
from. It is also possible that my code needs to be made more
deterministic in which EnityManagerFactory is being created.

I will debug this some more but do let me know if you spot an obvious
reason why I am getting into EclipseLink code when using hibernate JPA
and how I can avoid it. Thanks.

Mitesh Meswani wrote:
> >Exception Description: The type [class
> org.freebxml.omar.jaxb.bindings.rim._4_0.InternationalStringType] for
> the attribute [description] on the entity class [class
> org.freebxml.omar.jaxb.bindings.rim._4_0.RegistryObjectType] is not a
> valid type for a serialized mapping. The attribute type must implement
> the >Serializable interface.
>
> JPA spec requires attribute of an entity to be one of following
> <quote>
> The persistent fields or properties of an entity may be of the
> following types: Java primitive types;
> java.lang.String; other Java serializable types (including wrappers of
> the primitive types,
> java.math.BigInteger, java.math.BigDecimal, java.util.Date,
> java.util.Calendar[5], java.sql.Date, java.sql.Time, java.sql.Timestamp,
> byte[], Byte[], char[], Character[], and user-defined types that
> implement the Serializable
> interface); enums; entity types; collections of entity types;
> embeddable classes (see Section
> 2.5); collections of basic and embeddable types (see Section 2.6).
> </quote>
>
> I assume you want
> org.freebxml.omar.jaxb.bindings.rim._4_0.InternationalStringType to be
> saved in serialized form in database. The validation catches the cases
> where it is not marked as such.
>
> On 1/24/2010 3:34 PM, Farrukh Najmi wrote:
>>
>> After working around the "The getter method on entity class does not
>> have a corresponding setter method defined" issue in my schema I
>> thought I would be home free but now I am getting a new exception:
>>
>> I just dont understand why I do not see these errors in GF V3 Prelude
>> but see them in GF V3 final. Also why is it a problem that my class
>> for Type T of attribute A in class C does not implement the
>> Serializable interface? Please tell me how I can have the same
>> behavior as V3 Prelude. Many Thanks.
>>
>> Internal Exception: javax.persistence.PersistenceException: Exception
>> [EclipseLink-28018] (Eclipse Persistence Services -
>> 2.0.0.v20091127-r5931):
>> org.eclipse.persistence.exceptions.EntityManagerSetupException
>> Exception Description: Predeployment of PersistenceUnit
>> [omar4-persistence-unit] failed.
>> Internal Exception: Exception [EclipseLink-7155] (Eclipse Persistence
>> Services - 2.0.0.v20091127-r5931):
>> org.eclipse.persistence.exceptions.ValidationException
>> Exception Description: The type [class
>> org.freebxml.omar.jaxb.bindings.rim._4_0.InternationalStringType] for
>> the attribute [description] on the entity class [class
>> org.freebxml.omar.jaxb.bindings.rim._4_0.RegistryObjectType] is not a
>> valid type for a serialized mapping. The attribute type must
>> implement the Serializable interface.
>> at
>> com.sun.enterprise.web.WebApplication.start(WebApplication.java:117)
>> at
>> org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
>> at
>> org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
>> at
>> org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
>>
>> at
>> org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
>>
>> at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
>>
>> at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
>>
>> at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
>>
>> at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
>>
>> at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
>>
>> at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
>>
>> at
>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
>>
>> at
>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
>> at
>> com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
>>
>> at
>> com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
>>
>> at
>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
>>
>> at
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
>> at
>> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
>> at
>> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
>>
>>
>> Farrukh Najmi wrote:
>>>
>>>
>>> Doh! I just see that though the error is the same it is on a
>>> different class now. Apparently I had read the log file incorrectly.
>>> My bad.
>>>
>>>
>>> Lastly, Mitesh is there a way to tell GF V3 Final to ignore such
>>> errors silently?
>>>
>>>
>>> Mitesh Meswani wrote:
>>>> Hi Farukh,
>>>>
>>>> I can not spot anything wrong with your entity snippet below. Can
>>>> you please post the whole entity class and full exception log
>>>> including nested exceptions.
>>>>
>>>> >However, I am still seeing the same error. BTW, I am using
>>>> hibernate entity manager and not toplink. I do have the Hibernate
>>>> JPA Add ON installed.
>>>> >Why is EclipseLink code being run in stack trace?
>>>> How are you wiring up your EM to run against Hibernate? Is the PU
>>>> created JavaSE style (your code calls Persitence.createEMF() ) or
>>>> JavaEE style (you inject/look up em/emf)?
>>>>
>>>> Thanks,
>>>> Mitesh
>>>>
>>>> On 1/21/2010 3:47 PM, Farrukh Najmi wrote:
>>>>>
>>>>> GF team, please let me know if my messge is not clear. What is
>>>>> this error I am seeingm why am I seeing it and what can I do to
>>>>> get past it?
>>>>> Should I file a P2 issue?
>>>>>
>>>>> Farrukh Najmi wrote:
>>>>>> Hi Guys,
>>>>>>
>>>>>> I was getting this exception due to JAXB RI XJC issue:
>>>>>>
>>>>>> https://jaxb.dev.java.net/issues/show_bug.cgi?id=733
>>>>>>
>>>>>>
>>>>>> Exception Description: An exception was thrown while searching
>>>>>> for persistence archives with ClassLoader: WebappClassLoader
>>>>>> (delegate=true; repositories=WEB-INF/classes/)
>>>>>> Internal Exception: javax.persistence.PersistenceException:
>>>>>> Exception [EclipseLink-28018] (Eclipse Persistence Services -
>>>>>> 2.0.0.v20091127-r5931):
>>>>>> org.eclipse.persistence.exceptions.EntityManagerSetupException
>>>>>> Exception Description: Predeployment of PersistenceUnit
>>>>>> [xxx-persistence-unit] failed.
>>>>>> Internal Exception: Exception [EclipseLink-7174] (Eclipse
>>>>>> Persistence Services - 2.0.0.v20091127-r5931):
>>>>>> org.eclipse.persistence.exceptions.ValidationException
>>>>>> Exception Description: The getter method [method
>>>>>> isReturnComposedObjects] on entity class [class
>>>>>> xxx.ResponseOptionType] does not have a corresponding setter
>>>>>> method defined.
>>>>>> at
>>>>>> com.sun.enterprise.web.WebApplication.start(WebApplication.java:117)
>>>>>> at
>>>>>> org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
>>>>>> at
>>>>>> org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
>>>>>> at
>>>>>> org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
>>>>>>
>>>>>> at
>>>>>> org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
>>>>>>
>>>>>> at
>>>>>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
>>>>>>
>>>>>>
>>>>>> I worked around the above issue (by removing default="false" in
>>>>>> xsd) so that the generated class has corresponding setters and
>>>>>> getters:
>>>>>>
>>>>>> @XmlAccessorType(XmlAccessType.FIELD)
>>>>>> @XmlType(name = "ResponseOptionType")
>>>>>> public class ResponseOptionType
>>>>>> {
>>>>>>
>>>>>> @XmlAttribute
>>>>>> protected Boolean returnComposedObjects;
>>>>>>
>>>>>> ...
>>>>>>
>>>>>> public Boolean isReturnComposedObjects() {
>>>>>> return returnComposedObjects;
>>>>>> }
>>>>>>
>>>>>> /**
>>>>>> * Sets the value of the returnComposedObjects property.
>>>>>> *
>>>>>> * @param value
>>>>>> * allowed object is
>>>>>> * {_at_link Boolean }
>>>>>> * */
>>>>>> public void setReturnComposedObjects(Boolean value) {
>>>>>> this.returnComposedObjects = value;
>>>>>> }
>>>>>>
>>>>>> ...
>>>>>>
>>>>>> }
>>>>>>
>>>>>> However, I am still seeing the same error. BTW, I am using
>>>>>> hibernate entity manager and not toplink. I do have the Hibernate
>>>>>> JPA Add ON installed.
>>>>>> Why is EclipseLink code being run in stack trace?
>>>>>>
>>>>>> What could possibly be wrong now?
>>>>>>
>>>>>> Note that things are fine on Glassfish V3 Prelude but dont work
>>>>>> in Glassfish V3 Final and this is blocking my product and
>>>>>> customers to migrate to Glassfish V3 Final. Thanks for your help.
>>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>


-- 
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com