Hi!

Robert Taylor wrote:
> I have proxy class that contains some static methods. These static methods
> access an RMI remote object via a JNDI lookup and put the remote object to
> work.  When one of these static methods is called on the proxy class, the
> first thing it does is initialize itself if it is not already initialized.
> The initialization process binds the RMI remote object to the JBoss JNDI
> tree if the object is not already bound.
> The test application then gets a remote reference to the TestBean and calls
> a method which in turn calls the same method on the proxy class as above.
> When the JBoss VM loads the proxy class, it finds that the RMI remote object
> is already bound to the JBoss JNDI tree. The proxy class access the RMI
> remote object and puts it to work.
> 
> The test application exits.
> 
> Now, if I restart the test application to repeat the process, I get the
> following exception:
> 
> java.rmi.ConnectException: Connection refused to host: 192.168.0.102; nested
> exception is:

Of course. Let's repeat what you have done:
1) Start test app. Create RMI object. Bind objects stub in JNDI.
2) Exit test app. RMI object is now gone, since it lived in your test
app.
3) Start test app. No RMI object creation, since it finds the stub in
JNDI.
4) Call RMI object. Crash.

Since your object dies in 2 it's perfectly normal that 4 don't work...

Solution: create an MBean which initializes and store the stub in JNDI.
Remember to have the MBean store a reference to the actual RMI object as
well or it will be GC'ed (JNDI does not count as a reference).

/Rickard

-- 
Rickard �berg

Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to