java.rmi.NotBoundException exception

Posted on 2009-12-29
Last Modified: 2013-11-24
I am getting " java.rmi.NotBoundException " error on my client side when I try to lookup for server registry.

My server side code::
ATMFactoryImpl atmfactory = new ATMFactoryImpl();
Naming.rebind("//localhost/atmfactory/", atmfactory);

Client side code:
ATMFactory factory = (ATMFactory)Naming.lookup("//localhost/atmfactory");
atm = factory.getATM();

I dont know why I am getting that exception, I am running rmiregistry.
Question by:rocky_singh
    LVL 92

    Accepted Solution

    > Naming.rebind("//localhost/atmfactory/", atmfactory);

    should be:

    Naming.rebind("atmfactory", atmfactory);

    Author Comment

    Thanks Objects,

    I am seeing another issue now.
    My client is giving this error:

    Exception in thread "main" java.lang.ClassCastException: $Proxy0 cannot be cast to cscie160.project.ATMFactory at cscie160.project.Client.main(

    I don't know from where this $Proxy0 is coming.
    Can you please help !!!
    LVL 92

    Expert Comment

    check ATMFactoryImpl implemts ATMFactory
    and check your classpaths are all setup correctly

    Author Comment

    Hi Objects,

    I checked all of classpaths they are all fine.
    what else could be a possible reason?


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now