You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeremy Howard <je...@flashcom.net> on 2000/08/28 06:05:37 UTC

Calling a RMI Server from a Servlet running under Tomcat

Good evening Everyone,

I've got a slightly off the subject question.  Is it possible to call a RMI
Server class from a servlet?  I'm sorry if this is a stupid question.  I've
started the switch from Visual Basic/ASP to Java (3 weeks ago) and would
like some input on this before I set out on the journey :).  Thanks in
advance.

Jeremy Howard



RE: Calling a RMI Server from a Servlet running under Tomcat

Posted by Jeremy Howard <je...@flashcom.net>.
Duncan,

You just plain awsome!!  I used your example and the RMI tutorial on suns
website.  In just a few short hours everything works!!!  Thank you sir. :)

Jeremy Howard

-----Original Message-----
From: Duncan Reade [mailto:duncan@spinne.ip.lu]
Sent: Monday, August 28, 2000 5:39 AM
To: tomcat-user@jakarta.apache.org
Subject: Re: Calling a RMI Server from a Servlet running under Tomcat


Jeremy,
This is no problem

here's an example from our code


   /**
    * Establishes a connection to the remote Subscription Manager.
    *
    * @param subscriptionManagerURL The URL specifying the location of
the remote subscription Manager
    *
    **/
    protected boolean initSubscriptionManager(String
subscriptionManagerURL)
    throws ServletException
    {
	boolean rv = false;

        try {
		_remoteSM =
(elsme.subscription.SubscriptionManager)Naming.lookup(subscriptionManagerURL
);
		if (_remoteSM != null) {
			_remoteSM.init();
			rv = true;
		}
	} catch (RemoteException ex) {
		Log.stacktrace("initSubscriptionManager: remoteException", ex);
	} catch (Exception ex) {
        	Log.stacktrace("initSubscriptionManager", ex);
        }
        return rv;
    }

where subscriptionManagerURL is something like:

"rmi://localhost:1099/subscriptionman"

Hope this helps,

Duncan

Jeremy Howard wrote:
>
> Good evening Everyone,
>
> I've got a slightly off the subject question.  Is it possible to call a
RMI
> Server class from a servlet?  I'm sorry if this is a stupid question.
I've
> started the switch from Visual Basic/ASP to Java (3 weeks ago) and would
> like some input on this before I set out on the journey :).  Thanks in
> advance.
>
> Jeremy Howard

--
***********************************
Duncan Reade
INFOPARTNERS S.A.
Tel    +352/ 40116-3303
Fax    +352/ 40116-2331
email  dreade@ip.lu
URL    http://www.infopartners.lu/
***********************************


Re: Calling a RMI Server from a Servlet running under Tomcat

Posted by Duncan Reade <du...@spinne.ip.lu>.
Jeremy,
This is no problem

here's an example from our code


   /**
    * Establishes a connection to the remote Subscription Manager.
    *
    * @param subscriptionManagerURL The URL specifying the location of
the remote subscription Manager
    *
    **/
    protected boolean initSubscriptionManager(String
subscriptionManagerURL)
    throws ServletException
    {
	boolean rv = false;

        try {
		_remoteSM =
(elsme.subscription.SubscriptionManager)Naming.lookup(subscriptionManagerURL);
		if (_remoteSM != null) {
			_remoteSM.init();
			rv = true;
		}
	} catch (RemoteException ex) {
		Log.stacktrace("initSubscriptionManager: remoteException", ex);
	} catch (Exception ex) {
        	Log.stacktrace("initSubscriptionManager", ex);
        }
        return rv;
    }

where subscriptionManagerURL is something like:

"rmi://localhost:1099/subscriptionman"

Hope this helps,

Duncan

Jeremy Howard wrote:
> 
> Good evening Everyone,
> 
> I've got a slightly off the subject question.  Is it possible to call a RMI
> Server class from a servlet?  I'm sorry if this is a stupid question.  I've
> started the switch from Visual Basic/ASP to Java (3 weeks ago) and would
> like some input on this before I set out on the journey :).  Thanks in
> advance.
> 
> Jeremy Howard

-- 
***********************************
Duncan Reade
INFOPARTNERS S.A.
Tel    +352/ 40116-3303
Fax    +352/ 40116-2331
email  dreade@ip.lu
URL    http://www.infopartners.lu/
***********************************