Rmi and reference to remote object

how I can obtain a reference to a remote object and not its value?

This will happen automatically once it is exported and you return it from the server via an RMI call, e.g. Naming.lookup() or as the result of another remote method.

Similar Messages

  • Do I have to use lookup() to get a reference of remote object?

    Hello,
    I appreciate the help from you guys in advance. My question is, do I have to use lookup() to get the reference to a remote object? Right now I want to pass the remote object itself which can be serialized via stream. I am not sure if this way works.
    Cheers!
    Steve

    some part code:
    client:
    lookup=UC_LookUp.StkTakeListingHdrLookup().getStkTake(usrInfo,tfStkTakeListNo.getText());
    UC_LookUp
    public static basewms.uc.interfaces.UC_ISCSStkTakeListingHdr_Remote StkTakeListingHdrLookup()
          if (look_up==null) look_up= new UC_LookUp();
          if(stktakelistinghdr == null)
          stktakelistinghdr = look_up.startLookUp("UCStkTakeListingHdr","192.168.10.98", 7000);
          while (stktakelistinghdr==null)
               try { Thread.sleep(1000); }catch(InterruptedException e) {}
          return (basewms.uc.interfaces.UC_ISCSStkTakeListingHdr_Remote)look_up.getRemote(stktakelistinghdr);

  • Flex/Air and Web Services/Remote Objects

    If I'm calling a web service operation, either through the
    mx:webservice or mx:remoteobject tags, do I need to configure my
    Flex or Air project (I'm using the latest Flex Builder IDE) with
    the "use remote object access service" when creating the project?
    When do I need to configure services-config.xml or
    remoting-config.xml?
    Can't I simply call a web service operation by specifying the
    endpoint (if using mx:remoteobject) or the wsdl location for the
    service and then invoking one of its methods? I'm having a very
    difficult time consuming a web service through either method (even
    on my own local ColdFusion 8 developer instance) and need some
    assistance. I've looked all over the internet for help, but, so
    far, without success.
    Thanks,
    -Jose

    You do not need to specify any server to use any of the RPC
    protocols.
    Have you looked at an example?
    You have not said what problems you are having.
    Be aware of crossdomain security issues.
    Tracy

  • Flex and CFC with Remote Object

    I wrote a simple cold fusion componenet on my webserver at:
    http://www.paramountmediainc.com/webservices/eadexchange/agent_sys.cfc
    Now I want to play with that in Flex with a Remote Object.
    I'm writing the flex on my local machine. I tried this approach but
    was uncessfull:
    <mx:RemoteObject id="acctRO" showBusyCursor="true"
    source="webservices.eadexchange.agent_sys"
    endpoint="
    http://www.paramountmediainc.com/flashservices/gateway">
    I get the following error ...
    TypeError: Error #1034: Type Coercion failed: cannot convert
    Object@3b15da1 to mx.messaging.messages.ErrorMessage.
    Any ideas what I'm doing wrong here?

    You cant really replace Struts with Flex, maybe a view part
    , thats about is, you still need backend processioning
    logic,all that you are asking is difficult to answer is one reply,
    IMHO, best thing you can do is to dive into following URLs :
    http://www.adobe.com/devnet/flex/
    http://livedocs.adobe.com/flex/3/html/help.html?content=Part2_DevApps_1.html
    http://livedocs.adobe.com/blazeds/1/blazeds_devguide/
    http://livedocs.adobe.com/flex/3/html/help.html?content=Part6_ProgAS_1.html
    and of course your best friend :
    http://livedocs.adobe.com/flex/3/langref/index.html

  • RMI and stub

    i have an ServerIfc.java which is an interface for the RMI (and extends the Remote object) , and ServerImpl.java which is an implemmentation of the ServerIfc.java interface.
    when i execute the rmic command i got ServerImpl_stub.class.
    My question is , if any change in the ServerImpl.java (e.g add System.out) will cause the ServerImpl_stub.class to be changed too? does the ServerImpl_stub.class will be changed only if the ServerIfc.java will be changed??

    I think yes. If you change anything in the interface's implementation the generated stubs and/or skeletons will change too.
    If you change the interface, your implementation-class should change as well. That is quite obvious. Thus, your stubs and skellies will change as well after you've compiled with rmic.
    This question belongs in the RMI forums though...

  • Help needed to move a java.rmi.Remote object.....

    Hi,
    I have an object extending java.rmi.Remote on a server. I want to get it onto a client (ie the actual object, not a reference to the object on the server).
    The catch (isn't there always one):
    The client must only get class definitions/interface definitions from the java.rmi.server.codebase
    (ie I don't want to use a network classloader).
    Anyone any ideas?
    Kev.

    If you have a class that implements java.rmi.Remote then the objects of that class by definition are available for Remote access (ie, they are passed by reference). Remote objects can't be passed by value. However, if you want objects of a particular class to be passed by value you could have the class implement java.io.Serializable instead of java.rmi.Remote.
    Hope this helps.

  • Re: replicating non-remote objects

    I don't know if I would necesarily encourage this behavior, but I
              wonder if a SCOPE_CLUSTER workspace would work? At the very least,
              it's worth looking into.
              Jason
              On Thu, 16 Sep 1999 17:29:54 -0500, "Sam" <[email protected]> wrote:
              >I have a hastable storing references of remote objects and other hastables
              >for caching , Can anyone suggest a way to replicate the hastable in a
              >cluster of 2 WL4.5 servers.
              >Is it possible?
              >
              >thanks,
              >Sam Jacob
              >
              >
              

    Alain is correct on both points.
              Alain Rogister wrote:
              > I believe SCOPE_CLUSTER in WorkspaceDef is only a placeholder for things
              > to come, since workspaces are not a clustered service yet.
              >
              > You might think of using JNDI as an alternative to workspaces, but it
              > won't be that easy. Quoting the clustering developer guide:
              >
              > <quote>
              > Note that you cannot reliably use the naming service to replicate
              > objects.
              > For example, if you bind an RMI object "myReplicatedObject" into a
              > cluster-wide JNDI tree, and "myReplicatedObject" from Server One
              > places a serializable -- but not Remote -- object "myDataObject" into
              > the
              > JNDI tree, that unRemoted object does not get replicated to other
              > servers in the cluster. If Server One fails and a client calls
              > "myReplicatedObject," the RMI service will be available, but its
              > "myDataObject" will not.
              >
              > If you need to guarantee access to some data that is produced or used
              > by a replicated object, you should store the data in a database so that
              > it
              > can be reached by any server in the cluster that is hosting the
              > replicated
              > service. An example of this is an entity EJBean.
              > </quote>
              >
              > Alain.
              > --
              > Alain Rogister
              > Ubiquity s.a.
              > http://www.ubiquity.be
              =====================================================
              Reply to the newsgroup. Don't reply to this mail
              alias. This is used only for answering posts on
              WebLogic Newsgroups.
              =====================================================
              

  • Best way to remote objects...

    What is my best option for hosting objects and accessing/instantiating them using Java SE and potentially other Java-based platforms (CDC, CLDC)?
    What I've been trying to do so far is set up some system where a Java SE program can connect to an application server and obtain references/instantiate objects on the server and call methods of those objects.
    The biggest struggle for me is understanding if JNDI is what I need to use for all this, on top of other questions.
    Am I going about this the wrong way? Is there something else I should be doing?
    I welcome any further questions or suggestions.

    Well...maybe, but also not quite?
    Is there any way I can get a more specific response? Is there any way I can run a server that hosts instances of objects? What is the simplest way I can instantiate and communicate with remote objects?
    Having a different stub for every class I create just seems like wasted effort and there are much more clumsy platforms out there that support very simple remote object & class features...

  • Interrupting a Thread in a Remote Object?

    HI,
    I am trying to get some thread synchronization to happen between a client and a remote RMI object. Essentially what I am trying to accomplish, is that if I interrupt a call on a blocking method in the remote object, I want the thread to throw the InterruptException. For example, the following code represents what I am trying to accomplish:
    package bca.test.rmi;
    import java.rmi.Naming;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    public class InterruptThreadApp {
    RemoteBlockingObjectInt remote = null;
    public static void main(String[] args) throws Exception {
    //Create the remote object
    RemoteBlockingObject obj = new RemoteBlockingObject();
    //bind it to the registry
    Naming.rebind("rmi://localhost/blocking", obj);
    //start the client, or the thread which will access the blocking call remotely
    InterruptThreadApp app = new InterruptThreadApp();
    Thread blocking = null;
    //wait for the thread to start
    synchronized ( app ) {
    blocking = app.startClient();
    app.wait();
    Thread.sleep(2000);
    //now interrupt the thread (note: the remote object should be blocking in
    //the blockingMethod().. this should produce an InterruptException?
    blocking.interrupt();
    public Thread startClient() {
    Thread t = new Thread("Client") {
    public void run() {
    try {
    //get a handle to the stub
    remote = (RemoteBlockingObjectInt) Naming.lookup("rmi://localhost/blocking");
    //now make a call to the blocking method, but first wake up the client
    synchronized ( InterruptThreadApp.this ) {
    InterruptThreadApp.this.notify();
    //now make the blocking call
    remote.blockingMethod();
    catch (InterruptedException e) {
    System.out.println("WooHoo! This is what we want! But it never gets thrown :(");
    catch (Exception e) {
    e.printStackTrace();
    t.start();
    return t;
    package bca.test.rmi;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.RemoteException;
    import java.rmi.Remote;
    public class RemoteBlockingObject extends UnicastRemoteObject implements RemoteBlockingObjectInt {
    Object obj = new Object();
    public RemoteBlockingObject() throws RemoteException {
    super();
    public void blockingMethod() throws RemoteException, InterruptedException {
    synchronized (obj) {
    System.out.println("About to block.. so we can be interrupted later");
    obj.wait();
    interface RemoteBlockingObjectInt extends Remote {
    public void blockingMethod() throws RemoteException, InterruptedException;
    When I make a call to "remote.blockingMethod()", it blocks in the remote object (buy just "wait" ing). I want to interrupt this thread, by issuing an Thread.interrupt(). When I do so (I call "blocking.interrupt()"), nothing happens... no exception is thrown.. it just silently fails.
    Ok, so I suppose that we can not interrupt a remote thread.. that is fine. But what if I want to interrupt the RMI thread making the remote call? I don't want it to block forever. How can I "cancel" the remote call?
    Ideally, I would like the remote.blockingMethod() call to throw an InterruptException when I issue an "interrupt()" on the blocking thread. Any suggestions on how I might accomplish this?
    Thanks,
    Bryan

    While you can interrupt the RMI call, you cannot stop the active processing. That is, you cannot force a thread to stop (see the Java API documentation on Thread.stop().)
    Since the Client RMI call is a waiting thread, you need another Client thread to do a secondary RMI call. The trick is to have the new RMI endpoint connection thread on the RMI Server interrupt the original RMI endpoint connection thread.
    The only way you can interrupt an RMI call is to have the endpoint connection thread that runs on the RMI Server be aware that the user may wish to interrupt it.
    The best means of interruption is for the endpoint connection thread to use "worker threads". The endpoint connection thread waits for the workers to finish and is interruptible by both the workers and other endpoint connection threads.
    Another means of interruption is for the endpoint connection thread to segment the task into units of work and check for an interruption between those units of work.
    There are two ways I've done RMI call interruption.
    One is for the Client to pass a unique id (UID -- that uniquely identifies the request) to the Server with the original call. When the Client wishes to interrupt the original call, using the separate thread, it does a new RMI call to the Server passing the UID.
    The new endpoint connection thread, using the UID, interrupts the original endpoint connection thread.
    The major problem with this is the unique id. It absolutely, positively must be unique. Otherwise you run the risk of Client_A purging Client_B's request.
    The second method requires callback. If your Client is behind a firewall then RMI callback is near impossible. In such a case you must come up with a way for the Server to call the Client that is secure (the firewall problem.)
    The Client must export a remote object and pass that remote object to the Server with the original call.
    The endpoint connection thread recognizes the remote object and does a call back to the Client passing information that uniquely identifies itself (UID). Since the Server generates the UID, it can guarantee uniqueness.
    The Client callback implementation runs as a separate thread since the Client is in fact an RMI Server itself (when it did the export.) The Client must save the UID. The Client must start a new thread for the interrupt procedure or inform a waiting thread that the Server called back.
    Just like method one, above, when the Client wishes to interrupt the original call, using the separate thread, it does a new RMI call to the Server passing the UID.
    The new endpoint connection thread, using the UID, interrupts the original endpoint connection thread. Simple.
    For an academic example using call back go over to Jini.org. They have an example called "Cancellation" at:
    http://starterkit-examples.jini.org/
    For a professional, open source implementation of both these methods go over to CoopSoft.com. The Tymeac (Java) projects support canceling both waiting and autonomous requests at:
    http://www.coopsoft.com/JavaProduct.html

  • RMI and Threads: Calling wait() on a remote object

    I created a counter as a remote object.
    Multiple clients are displaying the counter value.
    If one of the clients increments the counter, I want the displayed counter value on every client to be updated to the new value (of the counter on the server).
    Therefore every client starts a new thread to "listen" for changes of the countervalue. I wanted to call the wait() method on the remote object (the remote counter). But i think it will be called on the stub instead of on the actual remote object.
    Therefore i created a extra method waitForChange() on the remote object.
    public void waitForChange() throws RemoteException, InterruptedException {
         synchronized(this) {
              wait();
    This method only calls the wait() method. Now I'm sure it's called on the remote object and not on the stub.
    This works, but my question is: is there a better way to do this?
    Code:
    ==========================================
    The remote interface
    ==========================================
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface RemoteCounter extends Remote {
         void incrementCounter() throws RemoteException;
         int getCounterValue() throws RemoteException;
         void waitForChange() throws RemoteException, InterruptedException;
    } ==========================================
    The implementation of the remote interface
    ==========================================
    import java.rmi.*;
    import java.rmi.activation.*;
    import RemoteCounter;
    public class RemoteCounterImpl extends Activatable
         implements RemoteCounter {
         private static final long serialVersionUID = 1L;
         private int counter = 0;
         protected RemoteCounterImpl(ActivationID id, MarshalledObject data) throws RemoteException {
              super(id, 0);
         public void incrementCounter() throws RemoteException {
              synchronized(this) {
                   counter++;
                   notifyAll(); //Inform all clients of the new countervalue;
         public void waitForChange() throws RemoteException, InterruptedException {
              synchronized(this) {
                   wait();
         public int getCounterValue() throws RemoteException {
              return counter;
    }==========================================
    A piece of code registering the remote object
    ==========================================
    ActivationDesc desc = new ActivationDesc(agi, "RemoteCounterImpl", codebase, data);
    //Register with rmid
    RemoteCounter counter = (RemoteCounter)Activatable.register(desc);
    // Bind the stub to a name in the registry running on 1099
    Naming.bind("Counter", counter);==========================================
    The panel containing a button, a label
    which starts a new thread listening for
    counter value changes
    ==========================================
    import javax.swing.*;
    import java.awt.Dimension;
    import java.awt.event.*;
    import java.rmi.*;
    import org.personal.exam.services.RemoteCounter;
    public class PanelCounter extends JPanel {
         private static final long serialVersionUID = 1L;
         JLabel labelX = new JLabel("Press testbutton");
         Thread t;
         RemoteCounter remoteCounter;
         public PanelCounter()     {
              try {
                   jbInit();
              } catch(Exception e) {
                   e.printStackTrace();
         private void jbInit() throws Exception
              this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
              this.setPreferredSize(new Dimension(450,300));
              // The securityManager is required to make is possible
              // to download classes from the server
              if (System.getSecurityManager() == null) {
                   System.setSecurityManager(new RMISecurityManager());
              //Create a testButton to increment the counter          
              JButton testButton = new JButton("Increment");
              testButton.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent arg0) {
                        incrementCounter();
              this.add(testButton);
              //Add a label to display the counter value
              this.add(labelX);
              // Create thread to listen for counter value changes
              try {
                   remoteCounter = (RemoteCounter)Naming.lookup("Counter");
                   CounterValueChecker cvl = new CounterValueChecker(labelX, remoteCounter);
                   //Start a thread to listen for changes of the countervalue
                 t = new Thread(cvl);
                 t.start();
              } catch(Exception e) {
                   e.printStackTrace();
              this.setVisible(true);
         private void incrementCounter() {
              String message = "error";
              try {
                   remoteCounter.incrementCounter();
                   message = "Current value is " + remoteCounter.getCounterValue();
              } catch(Exception e) {
                   System.out.println("Test Exception: " + e.getMessage());
                   e.printStackTrace();
              labelX.setText(message);
    }==========================================
    The runnable implementation used by the
    thread to wait for counterchanges
    ==========================================
    import java.rmi.RemoteException;
    import javax.swing.JLabel;
    import org.apache.log4j.Logger;
    import RemoteCounter;
    public class CounterValueChecker implements Runnable {
         private JLabel counterLabel;
         private RemoteCounter remoteCounter;
         public boolean keepChecking= true;
         private Logger logger = Logger.getLogger(this.getClass());
         public CounterValueChecker(JLabel counterLabel, RemoteCounter remoteCounter){
              this.counterLabel = counterLabel;
              this.remoteCounter = remoteCounter;
         public void run() {
              while(keepChecking) {
                   int newVal = -1;
                   synchronized(remoteCounter) {
                        try {
                             //remoteCounter.wait();
    //this does not work. I think because the wait() method is called on the
    //stub instead of on the actual remote object
                             remoteCounter.waitForChange();
                        } catch (InterruptedException e) {
                             keepChecking = false;
                             break;
                        } catch (RemoteException re) {
                             re.printStackTrace();
                        try {
                             newVal = remoteCounter.getCounterValue();
                        } catch (RemoteException re) {
                             re.printStackTrace();
                        counterLabel.setText("New value: " + newVal);
    }This is just a little test. Actually I want to notify clients of changes in data displayed in a Table. If one client saves one record of the data, i want the new record to be displayed immediatly on all clients that are viewing the same data.

    I've been doing some reading about RMI and callback.
    As I understand it, there's a remote object is running on the client now as wel. And the server makes a call to the client.
    But now the server makes a call to one client.
    And the point is, I want all clients to be updated with the new value.
    Does this mean, I have to keep a list with references to all clients connected to the server?
    I my code the notifyAll() method causes all waiting Threads (running on several clients) to wake up and do something (getting the new counter value).

  • Binding RMI-IIOP Remote Object in RMI Registry through JNDI

    hi friends
    I am writing RMI-IIOP Remote Object, both server program, and client program
    are java programs. Through JNDI (with cosnaming name service), my program is working.
    But what i want is, I want to use JNDI (with rmi registry name service) for my RMI-IIOP Remote Object ( and not RMI -JRMP Remote Object). Both my server
    program and client programs are java(and not corba)
    I am not getting this, while starting server its showing some error
    Is it not possible to bind rmi-iiop remote object in rmi registry through jndi, why

    because you are supposed to use the COSNaming service with IIOP. Even if you could bind an IIOP remote object into an RMIRegistry the clients wouldn't be able to use it because the RMI Registry doesn't do the extra processing that the COSNaming service does with IIOP references.

  • Communication Error with Host and Remote Object

    Hi,
    I was executing my RMI program in a Linux Grid Network environment and the communication was no problem and the code did work.
    However I have switched to the same code to another network with linux machines and when try to execute the code I get the Error:
    java.rmi.ConnectIOException: Exception creating connection to: 136.186.14.96; nested exception is: java.net.NoRouteToHostException: No route to host
    136.186.14.96 is the place where the registry is running and Server Object is bound
    Client Locate the Registry as below
    LocateRegistry.getRegistry("136.186.14.96",1099);
    ACTUAL CODE:
    +//Pass The Remote Reference+
    +try {+
    oClient.registry = LocateRegistry.getRegistry(oClient.o_RegistryReference,oClient.i_Port);
    oClient.server = (ART_Interface) oClient.registry.lookup("Server_Obj");
    oClient.server.clientRegister(oClient.i_ClientID, oClient);
    System.out.println("SEQUENCE <1>  Client [" iID + "] Request to Register");+
    +} catch (Exception e) {+
    System.out.println("Client [" oClient.i_ClientID + "]Registration Error: " + e);+
    +}+
    Client Code Execution....
    +#ART_CLIENT <HOST> <PORT> <Client ID> <slavesPerClient>+
    java -cp /home/research/mbcooray/network/mercury/GRID/ -Djava.rmi.server.codebase=file:/home/research/mbcooray/network/mercury/GRID/ -Djava.security.policy=/home/research/mbcooray/network/mercury/GRID/Policy.txt ART_Client 136.186.14.96 1099 0 1 &

    No for multiple instances of clients communicating (Reporting) to Server, wouldn't server have a dedicated port for them?No. A remote object is exported on port X, the client forms an inbound (from the server's point of view) connection to it, an accepted-socket is created, also on X. netstat -an will show you that: X LISTENING and zero or more X ESTABLISHED. A TCP connection consists of the tuple {TCP, client-address, client-port, server-address, server-port}. Here 'server-port' is X, 'client-port' is allocated by the system. So there can exist multiple inbound connections to X, and the server-port number is always X.
    For Call backs I guess JVM gets hold of a random free portFor all outbound connections, TCP gets hold of a random free port.
    as it is running on a separate thread (I assume)Threads have nothing to do with it.
    Is this done by using socketfactory? Forget it. You don't want to do this, for the reasons I have. You probably don't need to do it, and if you do need to do it you should shoot the netadmin instead.
    Yes, the server exports the object and binds it in the local registryThat's not the same thing as exporting it on port 1099. You can specify a port number when exporting, or when calling super() if your remote objects extend UnicastRemoteObject. If you are using LocateRegistry.createRegistry(), port 1099 will get reused automatically for all subsequently-exported remote objects unless you are using a socket factory, which you aren't. If you are using a separate Registry you should specify the export port number yourself, and you can't re-use 1099.
    The background to this is that firewalls often contain rule configurations about what remote port numbers may be connected to, which corresponds to the reality that Internet services have fixed port numbers, so you can decide e.g. to allow your users to connect to HTTP servers (80,443,8080,8443) and SSH (22) but not for example Telnet (23). However by symmetry they often also allow similar rules for outbound port numbers, which are completely useless as they do not correspond to any reality whatsoever. If you have a netadmin who is enforcing outbound port number rules, just tell him to stop it.

  • Remote object trying to return another remote object and a ClassCastExcepti

    I have a server running with a TreeModel (the tree model implements Remote). I also have the the TreeNodes all linked together on the server. Now, I can get to the TreeModel on the server and the root node of the remote tree model.
    treeModelStub = (treeModelIface)Naming.lookup(url+"remoteTM"); //works
    rootStub = (remoteTreeNodeIface)treeModelStub.getRoot(); //works. The call to getRoot returns Object
    But when I call
    remoteTreeNodeIface aChild = (remoteTreeNodeIface)rootStub.getChildAt(index) //Does not work. "Exception in thread "main" java.lang.ClassCastException
    at remoteTreeNode_Stub.getChildAt(Unknown Source)
    The remote tree node method getChildAt returns TreeNode because the class implements TreeNode:
    public class remoteTreeNode extends UnicastRemoteObject implements rdcaDataIface, Comparable, TreeNode {
    public TreeNode getChildAt(int idx) {
    System.out.println("DEBUG: class is "+this.getClass()); // class is remoteTreeNode
    return (remoteTreeNode)children.get(idx);
    The remote interface is defined as:
    public interface rdcaDataIface extends java.rmi.Remote {
    public TreeNode getChildAt(int idx) throws RemoteException;
    Any ideas why this does not work. Why can a remote object of type Object be returned just fine, but a TreeNode not be returned?
    Thank you for your help,
    Brent

    I have a server running with a TreeModel (the tree
    model implements Remote). I also have the the
    TreeNodes all linked together on the server. Now, I
    can get to the TreeModel on the server and the root
    node of the remote tree model.
    treeModelStub =
    (treeModelIface)Naming.lookup(url+"remoteTM");
    //works
    rootStub =
    (remoteTreeNodeIface)treeModelStub.getRoot();
    //works. The call to getRoot returns Object
    But when I call
    remoteTreeNodeIface aChild =
    (remoteTreeNodeIface)rootStub.getChildAt(index)******************************************
    can only be casted to rdcaDataIface. The returned object is an instanceof the rdcaDataIface_stub, which have nothing to do with TreeNode.
    //Does not work. "Exception in thread "main"
    java.lang.ClassCastException
    at remoteTreeNode_Stub.getChildAt(Unknown
    t(Unknown Source)
    The remote tree node method getChildAt returns
    TreeNode because the class implements TreeNode:
    public class remoteTreeNode extends
    UnicastRemoteObject implements rdcaDataIface,
    Comparable, TreeNode {
    public TreeNode getChildAt(int idx) {
    System.out.println("DEBUG: class is
    lass is "+this.getClass()); // class is
    remoteTreeNode
    return (remoteTreeNode)children.get(idx);
    The remote interface is defined as:
    public interface rdcaDataIface extends java.rmi.Remote
    public TreeNode getChildAt(int idx) throws
    ows RemoteException;
    Any ideas why this does not work. Why can a remote
    object of type Object be returned just fine, but a
    TreeNode not be returned?
    Thank you for your help,
    Brent

  • Over technologies rather than RMI to pass remote objects

    Hi,
    Just a general question about remote objects. Currently I am familiar with RMI, IIOP and JMS to pass remote objects. What other technologies are available? in particular, technologies for passing remote objects between different software systems?
    Just a simple response detailing the names would be great, gives me something to research then.
    thanks

    ofcourse passing over socket is always an option. Sure in that case you will have to serialize the object yourself or make a mini-protocol of some kind.
    In our project we also use XML to pass object between C++ and Java world, instead of using CORBA.

  • Error passing a remote object in a rmi function call

    Hi,
    I've a problem passing an UnicastRemoteObject extended object in a rmi function call. I get the following error
    java.lang.IllegalArgumentException: argument type mismatch
    I've 2 Remote Objects: GalaxyRegistration and Station. I want to pass a Station Object as argument in a function from GalaxyRegistration. Does anyone know what the problem is?
    Here is the code:
    public class GalaxyRegistration
    extends UnicastRemoteObject
    implements GalaxyRegistrationInterface, Galaxy {
         public GalaxyRegistration() throws RemoteException {
         public void add(Station station) throws RemoteException {
              stations.addElement(station);
              System.out.println("Add Station " + station.getName());
    public class Station
    extends UnicastRemoteObject
    implements StationInterface {
         SystemInfo system;
         public Station(String name, String description, Coordinate position, Profile profile)
    throws RemoteException {
              system = new SystemInfo(name, description, position, profile);
    public class StationServer {
         Station station;
         public void run() {
              // create new Station
              System.out.println("Create new Station:");
              // register and bind new station
              try     {
                   station = new Station(name, descr, location, profile);
                   System.out.println("Station created ...");
                   GalaxyRegistrationInterface registry =
                             (GalaxyRegistrationInterface)
                             Naming.lookup
    ("//localhost/GalaxyRegistration");
                   System.out.println("Registry looked up ...");               
                   // >>>>>>>> NEXT LINE IS THE ERROR LINE <<<<<<<<<<<<<<     
                   registry.add(station);
              } catch(Exception e) {
                   System.out.println(e);
    }

    regardless of any other problems in your code, neither of the objects which you are subclassing from UnicastRemoteObject call the superclass constructor, which is a pretty basic flaw - in this case, it will lead to neither of these objects being exported properly.

Maybe you are looking for