Sorry for being so dense, but I'm new to RMI and distributed computing in
general.
I think I get the picture now.
Test app lives in one VM, JBoss lives in another VM.
Test app creates RMI object (allocates memory address etc...) and binds to
JNDI.
Test app exits. Memory address to RMI object has no meaning.
Test app starts again, finds the RMI stub in JNDI but crashes because stub
does not reference old RMI object address space.
I'm not quite clear on what exactly an MBean is except that it refers to JMX
some how.
I'm guessing that it can be used as a sort of start up class that can be
called when JBoss starts up. This way the RMI object would live in the JBoss
VM and a call to it would access a valid object reference.
Thanks again.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Rickard �berg
Sent: Friday, October 27, 2000 1:15 AM
To: jBoss
Subject: Re: [jBoss-User] java.rmi.ConnectionException connection
refused
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]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]