• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NotBoundException

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to start the rmiregistry and server, but when I start my client, I am left with this error "java.rmi.NotBoundException".
I had checked for the binding name, everything looks correct for me. Pls someone help me
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please send the code...?

thanks
regards
 
sangeetha balasubramaniam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
public class SellerRegistration{ //Client

/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
try{
if(System.getSecurityManager() == null){

System.setSecurityManager(new RMISecurityManager());
}
RemoteInterface sellerInterface = (RemoteInterface)Naming.lookup("Seller");

//Creation of SellerObject from user input(1.Name, 2.Email, 3.TelephoneNumber)
SellerObject sellerObj = new SellerObject();
System.out.println(" Please enter the inputs 1)Name 2)Email 3)Telephone Number in this given order");

//Validate the user input
if(args.length == 3){

sellerObj.setName(args[0]);
sellerObj.setEmail(args[1]);
sellerObj.setTelephoneNumber(Integer.parseInt(args[2]));

}
else{
System.out.println("Invalid Number of user Input");
}

String sellerId = sellerInterface.sellerRegistration(sellerObj);

System.out.println("before writing to Seller Log file");

//Enter the success message for the Registration in Seller's Log File
String filePath= "C:\\j2sdk1.4.2_12\\bin\\DistributedSystems\\SellerLogfile.txt";
String action = "Register";

//Check whether the sellerId is valid to know the correct status
String status = "";
if(sellerId != null && !sellerId.equals("")){
status = "Success";
}else{
status = "Fail";
}
String[] contents = new String[3];
contents[0] = args[0];
contents[1] = args[1];
contents[2] = args[2];
new Service().writeToLog(filePath, action, status, contents);

System.out.println("after writing to Seller Log file");

}catch(Exception e){
System.out.println(e);
}

}
}

=================================

import java.rmi.*;

public class Broker { //Server

/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
System.setSecurityManager(new RMISecurityManager());
System.out.println("Main OK");
try{
RemoteInterface sellerInterface = new RemoteServant();
System.out.println("After creating Servant");
Naming.rebind("Seller", sellerInterface);
System.out.println("Broker Ready");
}catch(Exception e){
System.out.println("Broker server main");
}

}
}
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there anything to keep the server "alive" and up after you bind it to the registry? You can use another thread, or just Thread.sleep() to keep your server up and able to receive calls from the client.
 
reply
    Bookmark Topic Watch Topic
  • New Topic