Solved

Loosing connection when i restart server using RMI with Tomcat

Posted on 2004-09-12
11
343 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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 125 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
splitOdd10 challenge 5 108
eclipse java  build path 6 59
Java Options in Zimbra Server 2 54
by zero exception 10 41
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

803 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