need Help in reflect an RMI object

F

fAnSKyer

I want to reflect an RMI object. and save the values of each variable
using field.

However I can only get the interface of the RMI object.

If I reflect the interface, I can't get the what I need. But I don't
know how to reflect the RMI object.

Can anybody help me? Thanks a lot, fAnS
 
E

EJP

fAnSKyer said:
I want to reflect an RMI object. and save the values of each variable
using field.

However I can only get the interface of the RMI object.

If I reflect the interface, I can't get the what I need. But I don't
know how to reflect the RMI object.

You can only do that from inside the JVM where the remote object was
exported from, because that's where the variables are, and you need a
reference to the actual object, not to the stub.

If you're in another JVM and all you have is the stub, all you can
usefully do is call remote methods on the stub, and you don't need
reflection for that.
 
F

fAnSKyer

EJP 写é“:
You can only do that from inside the JVM where the remote object was
exported from, because that's where the variables are, and you need a
reference to the actual object, not to the stub.
Actually how can I get a reference to a actual object?
When I using RMI naming.lookup and I only get a interface..
If you're in another JVM and all you have is the stub, all you can
usefully do is call remote methods on the stub, and you don't need
reflection for that.
I can call remote methods, but what I need is the values for the
variables? Can you tell me how to write a remote methods to get these
Variables? I doubt in this situation I have to use reflect?


Thanks a lot, FanS
 
R

Rodrigo Zechin

Man, don't try to use reflection on RMI objects, just create a getter
for the fields you want to retrieve and call the getter.

(you will need to add it in the interface:)
int getField() throws RemoteException;

RZR
 
F

fAnSKyer

Thanks a lot :p


Rodrigo said:
Man, don't try to use reflection on RMI objects, just create a getter
for the fields you want to retrieve and call the getter.

(you will need to add it in the interface:)
int getField() throws RemoteException;

RZR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,081
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top