A rmi problem about exporting a remote object

here is the code:
public interface Hello extends Remote {
String sayHello() throws RemoteException;
public class HelloImpl extends UnicastRemoteObject
implements Hello {
public HelloImpl() throws RemoteException {
super();
public String sayHello() {
return "Hello World!";
public static void main(String args[]) {
if (System.getSecurityManager() == null) {
     System.setSecurityManager(new RMISecurityManager());
try{
     HelloImpl obj = new HelloImpl();
     Naming.rebind("//192.168.10.2:2001/HelloServer", obj);
     System.out.println("HelloServer bound in registry");
}catch (Exception e) {
     System.out.println("HelloImpl err: " + e.getMessage());
e.printStackTrace();
public class HelloClient{
public static void main(String[] args){
Hello obj = null;
String message="nobody say hello to me";
if (System.getSecurityManager() == null) {
     System.setSecurityManager(new RMISecurityManager());
try {
     obj = (Hello)Naming.lookup("//192.168.10.2:2001/HelloServer");
     message = obj.sayHello();
}catch (Exception e) {
     System.out.println("exception: "+e.getMessage());
     e.printStackTrace();
System.out.println(message);
where 192.168.10.2 is the ip address of my computer.
i'm using an mini-http server provided by sun,that is,ClassFileServer
here is my command lines:
java examples.classServer.ClassFileServer 2003 d:\java\rmi
start rmiregistry 2001
java -Djava.rmi.server.codebase=http://192.168.10.2:2001/
-Djava.security.policy=server.policy HelloImpl
then encountered the exception.
can someone tell me how can i export the HelloImpl and
make it can be invoked by client.
thanks a lot!

thank you for your reply,i tried it again like below:
java examples.classServer.ClassFileServer 2001 d:\java\rmi
start rmiregistry
java -Djava.rmi.server.codebase=http://192.168.10.2:2001/
-Djava.security.policy=server.policy HelloImpl
java HelloClient
but could not work,the exception raised at the client point is like that:
java.rmi.Naming.lookup(unknown source)....
i want to know how could the client know how to contact with
rmiregistry,where the client trying to lookup(//192.168.10.2:2001/HelloServer)
while rmiregistry running on the port 1099.
thank you!

Similar Messages

  • Exporting two remote objects on the same port

    Hi,
    I would like to export two remote objects on the same host, same port and bind them with different service names.
    There is no problem when I do that from the same Java program.
    But when I export and bind an object from a Java program 1, I cannot do the same with the second (and similar) Java program 2. This is the stack trace of my Exception:
    java.rmi.server.ExportException: Port already in use: 50040; nested exception is:
         java.net.BindException: Address already in use: JVM_Bind
         at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:243)
         at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:178)
         at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)
         at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:129)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:275)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:178)
         at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:75)Can some one help please

    It should work in any version of Java as long as the server socket factories are null or equal according to Object.equals() or its override in the SSF.equals() method if any. Which needs to be present and needs to take the form:
    public boolean equals(Object object)
      return object != null && object.getClass() == this.getClass();
    }with further tests if the server socket factories have additional state.

  • Object not exported for Remote object in WSAD

    Hi,
    I have a few classes that extend and implement java.rmi.remote object. The JAR is placed under WEB-INF/lib of a web application.
    I am using WSAD 5.1.1. When I start the server, it gives me the following error.
    Can somebody make out anything?? Please help
    Error Stack:
    [5/3/05 12:07:04:188 IST] 3d410866 Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
    Context implementation: com.ibm.ws.naming.jndicos.CNContextImpl
    Context method: rebind
    Context name: localhost/nodes/localhost/servers/server1
    Root exception is java.rmi.NoSuchObjectException: object not exported
    I tried creating the stub and the skeleton classes manually and added them to the JAR file but still I get the same error. The JAR is in the CLASSPATH of the server.
    I also tried creating a simple remote object and tried binding it:
    Hashtable propertiesMap = new Hashtable();
    propertiesMap.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
    propertiesMap.put(Context.PROVIDER_URL, "iiop://localhost:2809" );
    Context context= new InitialContext(propertiesMap);
    myRemote instance = new myRemote();
    context.bind("TestString",instance);
    Even this gives :
    javax.naming.ConfigurationException: Problem with PortableRemoteObject.toStub(); object not exported or stub not found. Root exception is java.rmi.NoSuchObjectException: object not exported
    at sun.rmi.transport.ObjectTable.getStub(ObjectTable.java:115)
    at java.rmi.server.RemoteObject.toStub(RemoteObject.java:88)
    at com.ibm.rmi.util.JDKBridge.getJRMPStub(JDKBridge.java:129)
    at com.ibm.rmi.javax.rmi.PortableRemoteObject.toStub(PortableRemoteObject.java:138)
    at javax.rmi.PortableRemoteObject.toStub(PortableRemoteObject.java:105)
    at java.lang.reflect.Method.invoke(Native Method)
    -sam

    Hi,
    Not sure if this question is not clear ... Can somebody give me some hints please??
    -sam

  • Exporting remote object

    once we export some remote object ie by extending UnicastRemoteObject or by calling its exportObject method
    Does it make any difference that whether the object is heavy (ie some comples GUI) or light ie some wrapper class which starts the server thread?
    and what exactly is the defination of marshalling ...and its difference with serialization
    thanks in advance

    Hi,
    As far as RMI is concerned there is no difference in the objects they handle... but it might show problems when u try to update your GUI components over the network...
    The process of 'marshalling' means the method of encapsulating the parameters given in the RMI call into a format which can be used to send the required info to the server.. it includes the process of grouping the info to the stubs about the method, the data type of the parameter, the value given in them the Class heirarchy and other details related to the object..
    Serialisation is a mechamism which is used in RMI for sending the object state across the servers.. It needn't be used with RMI only.. here the object state is captured ( like value, the class name, and all the attributes ) along with class heirarchy ( if it has parent classe or calls other objects of other classes ) is encapsulated and can be stored using the ObjectOutputStream's writeObject method.
    - Bibin.

  • 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

  • Is the Remote Object always a singleton?

    Hi,
    Using .Net Remoting we can export a Remote Objects in three different ways:
    1. Singleton: Same instance of a Server-side object is used by all the clients for all the requests.
    2. SingleCall: Whenever a new call is received, a new instance of the Server-side object is created and reference is passed to the client. Therefore, for each call to the server, the client gets a new instance of the object.
    3. Client Activation: In this, the Client requests to the server for creating a new instance which can be used for multiple calls. The instance activated by a client is not used by other clients. Client-Activated objects can store state information between method calls for its specific client.
    Do we have this options in RMI or the Remote Object must always be a Singleton?
    What I'm looking for is a way to create one instance of the Remote Object (in the server side) to each client that connects to a server.
    thx

    Do we have this options in RMI1 and 3 are available. 2 is not.
    or the Remote Object must always be a Singleton?No.
    What I'm looking for is a way to create one instance of the Remote Object (in the server side) to each client that connects to a server.It's as simple as 'return new MyRemoteObject(...);'.
    For example:
    public interface Login extends Remote
      public Session login(String username, ...) throws RemoteException;
    public interface Session extends Remote
      // your client API here
    public class LoginImpl extends UnicastRemoteObject implements Login
      public Session login(String username, ...) throws RemoteException
        // validate username etc. If OK return a session.
        return new SessionImpl();
    public class SessionImpl extends UnicastRemoteObject implements Session
      // your client API implementation here, also all the server-side state belonging to that client session
    }Note that this is as secure as the login() method. By type safety, nobody can execute Session methods until they have logged in.
    I'm deleting your two other threads.

  • Problem at EPS when duplicate object w/ gradient

    Hey, check that: In Illustrator CS5 I drew a square, applied gradient, duplicate and rotate it. Then I saved as EPS (Illustrator 8) and open in Corel. There is an error as the fill (gradient) had not been duplicated and rotated along with the path of the object.
    Illustrator CS5
    EPS Illustrator 8 open at Corel
    I know i can expand gradient into steps or mesh but what puzzles me is that recently bought a file at iStockphoto whose gradient is not converted into steps or mesh and it works!
    Open the file purchased with the element gradient and repeat the same process as described above. When I open it at Corel, the gradient is duplicated and rotated.
    I thank the attention of anyone who can help me with the solution or suggestions.

    In the market I work, most people uses Corel. And as I have intent to distribute my design, I need to generate a file that is mostly compatible with other editors.
    The problem about expanding gradient into objects is that I dont like the idea of dividing the gradient into hundreds of objects. The gradient mesh uses Clipping Path while the file I bought from iStockphoto is a path (apparently) common.
    I am looking for the solution to create linear gradients compatible with other editors without having to divide the shape into pieces or use Clipping Path. As i saw it's possible, I intend to find out how

  • 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.

  • 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.

  • Java.lang.ClassCastException: Cannot narrow remote object weblogic.rmi.inte

    Hi,
    I am trying to deploy ejb3.0 on weblogic 10 server. I am able to find the JNDI name of the stateless session bean correctly, but getting an exception while narrowing it down. My ejb3.0 client is a standalone java client. I am trying to access the stateless session ejb3.0 bean.Please help me. i have been trying it for many days.
    thanks in advance,
    Sanjeev
    [sanpraka@localhost certEjb]$ java -cp ./:/usr/weblogic/bea/wlserver_10.0/server/lib/weblogic.jar:/usr/weblogic/bea/wlserver_10.0/server/lib/wlclient.jar com.titan.clients.Client
    Object is weblogic.rmi.internal.BasicRemoteRef - hostID: '5337880647112897730S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:wl_server:examplesServer', oid: '302', channel: 'null'
    java.lang.ClassCastException: Cannot narrow remote object weblogic.rmi.internal.BasicRemoteRef - hostID: '5337880647112897730S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:wl_server:examplesServer', oid: '302', channel: 'null' to com.titan.travelagent.TravelAgentRemote
    at weblogic.corba.server.naming.ReferenceHelperImpl.narrow(ReferenceHelperImpl.java:206)
    at weblogic.rmi.extensions.PortableRemoteObject.narrow(PortableRemoteObject.java:88)
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:32)
    at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
    at com.titan.clients.Client.main(Client.java:24)
    [sanpraka@localhost certEjb]$

    We have a similar problem. We have a web application (on server A) that invokes an EJB on a remote server (server B). This works fine, until we deploy another web application to server A at which point the existing web application starts to throw java.lang.ClassCastException when narrowing the remote EJB interface. The exception starts to be thrown at the moment the latter web application is deployed - start is not required.
    The latter web application contains (actually in APP-INF/lib) the old version of the EJB remote interface, that somehow gets to be loaded into the classpath of the existing web application. The solution is to delete the old version of the EJB remote interface from APP-INF/lib of the latter web application (we didn't need it anyway), but it would be interesting to know in which circumstances classes can get mixed between enterprise applications.
    I failed to reproduce the error in simple scenario, so this does not happen always.

  • 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.

  • 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).

  • 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.

  • 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.

  • Can't update remote object (RMI)

    I have made a class "A" that implements a remote interface "RI". I then rebind it to the rmiregistry:
    RI bob = new A();
    Naming.rebind("bob",bob);Class A has a few methods that I call that changes som private fields.
    After some time I start another class B that makes a look up:
    RI found  = (RI)Naming.lookup("//localhost/bob");But the private fields have not been changed in this looked up object.
    Is it necessary to call rebind each time I make a change to a remote object??

    If you'd stick to the same thread instead of starting a new one all over the place you'd find that I've already answered this question three days ago: http://forum.java.sun.com/thread.jspa?threadID=770735&messageID=4393030#4393030
    Can you stick to that thread please.

Maybe you are looking for

  • Removing songs from itunes without removing them from ipod

    Is it possible to remove songs from iTunes without removing them from iPod? When I attempt to delete songs from iTunes I get a warning that they'll be deleted from iPod as well. I've got Manually manage music and videos checked under Options in the S

  • RMAN-06067: RECOVER DATABASE required with a backup or created controlfile

    Hi, DB:9.2.0.8 OS: AIX 5.3 I am restoring DB with until time(12/06/2012) for needed tablespaces. I restored the 12th date controlfile ,which is backed up with archivedlogs. I also have one more controlfile which backed up with full DB.. Restore of ta

  • Mapping from pixels to cm

    hi all does anybody know how can i map between pixels and cm? taking into consideration i don't have the real picture's dimensions how can i tell the cm distance between 2 points on that picture but ofcourse i know the pixel distance between them? th

  • How to Start Archivelog for XE

    Hi Friends, I want to use RMAN backup for my 10gXE database so I need to start archivelog. I do the following: SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total

  • Border Manager 3.9 upgrade

    Are current subscription holders of SMB6.6 eligable for the upgrade to 3.9 border manager?