aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Can enum define its serialVersionUID or it has by default? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Can enum define its serialVersionUID or it has by default?" Watch "Can enum define its serialVersionUID or it has by default?" New topic
Author

Can enum define its serialVersionUID or it has by default?

Ramesh Babu K M
Greenhorn

Joined: Dec 17, 2009
Posts: 2
I heard that there is by default 0 present as serialVersionUID for enum, but i am facing following problem in one of my RelType enum class

java.rmi.MarshalException: CORBA MARSHAL 0x4942f89a No; nested exception is:
org.omg.CORBA.MARSHAL:
>> SERVER (id=4773e3aa, host=coimbatore.clr1968.mws.sutelab.blr) TRACE START:
>> org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : Mismatched serialization UIDs : Source (RepId RMI:com.nsn.oss.avg.avgxml.jaxb.RelType:22A6F48BE34B9767:FF87BD7BCD053D20) = FF87BD7BCD053D20 whereas Target (RepId RMI:com.nsn.oss.avg.avgxml.jaxb.RelType:22A6F48BE34B9767:762F93289AA86CDE) = 762F93289AA86CDE vmcid: IBM minor code: 89A completed: No
>> at com.ibm.rmi.iiop.CDRInputStream.read_value(CDRInputStream.java:2194)

in my webspehere server, i see different uids in client and server.

1. whats this problem?
2. how to resolve it?
3. can i manually add serialVersionUID=xxx to my enum?

please help in this regard

thanks
ramesh
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Welcome to javaranch Ramesh. You seem to have selected the wrong forum. This probably belongs in Java in general. A moderator will move it there shortly.

The serial version UID is not assigned to 0 by default. It is dynamically assigned each time. Have your tried assigning an ID for the enum ? Did it work ? Even if you do assign an ID, the problem seems to be with serializing and deserializing classes that were compiled with different javac versions. Can you elaborate about your problem a little more ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Ramesh Babu K M
Greenhorn

Joined: Dec 17, 2009
Posts: 2
Hi thank you so much,

My problem is, i have a xsd file which i will use to generate java classes from them using jaxb. In which there are some enum classes. all are serialized classes and have serialVersionUID assigned. but enums doesn't have these UIDs. and when i try to pass these objects from client to server i am getting the above error.
so whats the call?
can i assign manually one UID for enums also?

thanks in advance
Ramesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can enum define its serialVersionUID or it has by default?