File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Serializable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serializable" Watch "Serializable" New topic
Author

Serializable

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Hi,

I want to know if byte[] is serializable. Also how to i check if the entire obejct is serializable? I have an object which implements serializable, but at run time am getting NotSerializableExceptionexception. This happens only when I tun the app in clustered mode using apache and tomcat.

If I tun it in non clustered mode....everything looks fine.



An yhelp on this...pls
[ September 24, 2006: Message edited by: Mary Cole ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The error message tells you the nonserializable class:

java.io.NotSerializableException: com.icon.ntral.form.IrEnt$2

That's the second anonymous class defined in the class com.icon.ntral.form.IrEnt .


[Jess in Action][AskingGoodQuestions]
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362


This is my code in the inner class ...how do i make it serializable...The parent class implements serializable

Pls advice
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

You'd just have to make it into a named class -- i.e., define it inside the method or inside the class, rather than as an anonymous class, or even as a new top-level class (since it doesn't seem to need access to the enclosing class for anything.) Once you give it a name, then it's obvious how to declare that it implements Serializable.
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Can U pls elaborate on this....may be a sample code would help....pls its urgent

The Factory defined above is of type org.apache.commons.collections.Factory
[ September 26, 2006: Message edited by: Mary Cole ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

One option would just be this:

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Thanks a lot it worked
Abhijeet Joshi
Greenhorn

Joined: Mar 21, 2007
Posts: 1
God bless you guys! I had the same problem with the LazyList factory (inner class). Your postings were spot on.
Thanks a ton,
Abhijeet
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serializable