Bookmark Topic Watch Topic
  • New Topic

Effect of Non-Serialization in the remote Server?

 
Vijayakumar Rengaraj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 618
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 618
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Just tell me what are all the risks involved if my bean doesn't implement the Serializable interface?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49849
70
  • Mark post as helpful
  • send pies
  • Report post to moderator
Moving to our JSP forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic