aspose file tools*
The moose likes JSP and the fly likes Effect of Non-Serialization in the remote Server? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

Effect of Non-Serialization in the remote Server?

Vijayakumar Rengaraj
Greenhorn

Joined: Jun 09, 2010
Posts: 5
I've a plain Java bean which I used as a model in the MVC architecture. My application is running in the remote server. In this situation whether my model should implement the Serializable Interface. If yes, what will be a error/exception if I failed to implement a Serializable interface?
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
How is your Java bean running on the remote server. That is, is it running in a Java EE container? Spring? The server documentation should tell you the rules of when and what to serialize. It also depends on how you use your Java Bean. Do you store references to it in the session or application object (if you run in a web container) or do you just create, use, and destroy it in a single function? A quick Google search found java.io.NotSerializableException.
Vijayakumar Rengaraj
Greenhorn

Joined: Jun 09, 2010
Posts: 5
Thanks for the reply.

My web application is running in one of the webservers. I just create a javaBean and set some values and put it in the request scope. In my JSP I just get the bean from the request scope and print the value... simple.

For this simple process whether my been need to implement the serializable interface. And what are all the risks involved if I didn't implement the Serializable interface. I heard that we need to implement serializable to avoid accessing/changing the data through the network. Is it true?

Thanks in advance.
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
I suggest learning more about your server architecture. You mentioned it runs on one of your web servers but a web server alone won't run your JSP. You need a JSP container to do that. Do you have a distributed environment in which it's possible to create your Java Bean on one server and have the JSP process on another server? Do your servers support fail-over? Yes, you must implement Serializable if your JavaBean is sent across the network or is saved to disk at any time.
Vijayakumar Rengaraj
Greenhorn

Joined: Jun 09, 2010
Posts: 5
Just tell me what are all the risks involved if my bean doesn't implement the Serializable interface?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Moving to our JSP forum.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Vijayakumar Rengaraj wrote:Just tell me what are all the risks involved if my bean doesn't implement the Serializable interface?

I do not care for the tone that you have taken with people who are volunteering their time to help you. I have closed this topic. Please feel free to open a new topic on this subject where you will have the opportunity to show the proper level of politeness and gratitude for any help that you will receive.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Effect of Non-Serialization in the remote Server?