Solved

Loosing connection when i restart server using RMI with Tomcat

Posted on 2004-09-12
11
362 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

 

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

Industry Leaders: 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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.

696 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