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: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Mon, 25 Jan 2010 14:27:50 -0800

>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
>>>
>>
>>
>
>