Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Loosing connection when i restart server using RMI with Tomcat

Posted on 2004-09-12
11
Medium Priority
?
379 Views
Last Modified: 2013-11-24
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.
0
Comment
Question by:econcepts
  • 3
  • 3
  • 2
11 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 12041227
>> 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
 

Author Comment

by:econcepts
ID: 12041251
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 12041689
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:econcepts
ID: 12041780
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 12041872
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
 

Author Comment

by:econcepts
ID: 12042051
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
 
LVL 35

Accepted Solution

by:
TimYates earned 500 total points
ID: 12042203
> 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
 
LVL 35

Expert Comment

by:TimYates
ID: 12278055
The last solution I gave describes how I do it in all of my ejb apps...and it works fine for me ;-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question