Results 1 to 2 of 2
  1. #1
    Robbinz is offline Member
    Join Date
    Dec 2007
    Posts
    4
    Rep Power
    0

    Default RMI naming problem

    Ok heres the story.

    Im writing a banking system in RMI. Im new to Java and am not very strong in programming. Ive designed my program (I think) but im having a problem.

    Im having problems binding my server object to the object in the client. Im not sure how to do it?

    Can someone help?

    import java.rmi.Naming;

    //import bankInterface;

    // This program tries out some of the methods in the BankingImpl
    // remote object.

    public class BankClient
    {

    public static void main(String args[])
    {



    // Create an Account object for the account we are going to access.

    Account myAccount = new Account("steve", "1111");

    try {

    // Get a stub for the BankingImpl object (the stub implements the
    // Banking interface).

    BankInterface bank = (BankInterface)Naming.lookup(MyBank);

    System.out.println("My balance is: "+
    bank.balance(myAccount));

    bank.deposit(myAccount, 50000);

    System.out.println("Deposited $500.00, balance is: "+
    bank.balance(myAccount));

    bank.withdrawal(myAccount, 25000);

    System.out.println("Withdrew $250.00, balance is: "+
    bank.balance(myAccount));

    } catch (Exception e) {
    System.out.println("Got exception: "+e);
    e.printStackTrace();
    }
    }
    }

    Its the code in the red. My server name is MyBank.
    Any help would be greatly appretiated thanks.

  2. #2
    Robbinz is offline Member
    Join Date
    Dec 2007
    Posts
    4
    Rep Power
    0

    Default

    Ok I think I worked out that I have to put it as a string ("MyBank").
    At least this way its compiling.
    But now im getting some really weird errors that look like this....


Similar Threads

  1. Naming object instances
    By oldgit in forum New To Java
    Replies: 9
    Last Post: 02-08-2008, 12:18 AM
  2. Naming a Class
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-22-2007, 12:21 PM
  3. Naming conventions
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-03-2007, 10:53 AM
  4. javax.naming.NameNotFoundException: ejb/RatingEJB
    By Daniel in forum Enterprise JavaBeans (EJB)
    Replies: 2
    Last Post: 06-29-2007, 03:12 AM
  5. error in JNDI naming
    By jitendra.ibs in forum Java Servlet
    Replies: 0
    Last Post: 06-08-2007, 06:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •