Loosing connection when i restart server using RMI with Tomcat

Hi
  In  my application i have used RMI to connect my Struts Application with my server Code. the server is dealing with database. everything is working fine but if i restart server. My already running application which is deployed on tomcat gives exception and if i see the exception it gives that it has lost the connection through RMI while i have restarted the server. Why this problem is coming because if i restart the server it means my application which is on tomcat should connect to my server code through RMI. I think RMI works on behalf of connection oriented.
Do you have any suggestion for this

Thanx and rgds.
econceptsAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
TimYatesConnect With a Mentor Commented:
> Is it possible that without restarting that struts application again i will get connection of that java application using RMI.

Have all of your classes which make calls via RMI extend a base class

In this base class, cache the RMI remote references, and add a method that you can call to retrieve the reference

Check that the reference is valid, by trying to call a simple method via RMI before you pass tha handle back

If the reference is invalid, go through the lookup procedure again, to get the new reference :-)

That should work :-)  I use this method with my EJB/Struts application, and it seems to work fine :-)

Tim
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> if i restart the server it means my application which is on tomcat should connect to my server code through RMI

If you restart the server, your application will lose the connection.

>> my application which is on tomcat should connect to my server code through RMI

Can you explain a little more elaborately what is your application and what is your server code?
0
 
econceptsAuthor Commented:
Thanx mayankeagle for replying
 

My server Code is my remote object  which is dealing with database and having some business logic.Application is the client for this remote object. This client is written by using struts and deployed on tomcat.


Yes, As u have written that I will lose connection but it won't be possible to connect that remote object without restarting the client.

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Mayank SAssociate Director - Product EngineeringCommented:
If you restart Tomcat, it would also stop the running instance of the Struts application which is deployed on it.

>> I will lose connection but it won't be possible to connect that remote object without restarting the client

Why do you want to restart the client?
0
 
econceptsAuthor Commented:
actually i don't want to lose connection from server

The problem is what i want that if somebody restart server side then all the clients must continue there work whereever they left their client application

is it possible or not

0
 
Mayank SAssociate Director - Product EngineeringCommented:
By client, you mean the Struts application.... which is deployed on Tomcat, and so if Tomcat itself restarts, I don't see how they could continue their processing because the application resides at the Tomcat server-side, after all.
0
 
econceptsAuthor Commented:
sorry i could n't explain u
This time i think u will understand

server side mean not tomcat. my struts application is running on tomcat.

From server side i mean to say one separate application running on another computer. that is not on tomcat that is a java application and acting as server for me. I used RMI to connect that struts application to my another program that is server for me.

Now i want to know if i shutdown that application and then restart that on remote computer. My struts application gives me exception that connection refused by another java application because i have lost that RMI object reference.

Is it possible that without restarting that struts application again i will get connection of that java application using RMI.

I think now u will get what i want to say

Thanx for corporating
0
 
TimYatesCommented:
The last solution I gave describes how I do it in all of my ejb apps...and it works fine for me ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.