• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rebind() Problem

 
Francis John
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m facing little bit different problem regarding Naming.rebin()..........In this problem, rmiregistry is not working n the error is occured with this line.........
"Port is not a number" even i m using the same format to write hostname and port number what is the problem here ..........plz guide me........
import java.rmi.*;
import java.rmi.server.*;
public class HelloWorldImpl extends UnicastRemoteObject implements HelloWorld
{ public HelloWorldImpl() throws RemoteException
{ super(); }
public String sayHello(String name)
{ return "Hello "+ name; }
public static void main(String[] args)
{ if(System.getSecurityManager()==null)
System.setSecurityManager(new RMISecurityManager());
try { HelloWorldImpl hw = new HelloWorldImpl();
System.out.println("Trying to bind");
Naming.rebind("//localhost:1098/HelloWorldImpl",hw);
System.out.println("Bound"); }
catch(Exception e) {
e.printStackTrace(); } }}
import java.rmi.*;public interface HelloWorld extends Remote{ public String sayHello(String name) throws RemoteException;}
 
ashwinpatil patil
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try it out using this :
Naming.rebind("HelloWorldImpl",hw);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!