Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1642
  • Last Modified:

java.rmi.NotBoundException exception

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.
0
rocky_singh
Asked:
rocky_singh
  • 2
  • 2
1 Solution
 
objectsCommented:
> Naming.rebind("//localhost/atmfactory/", atmfactory);

should be:

Naming.rebind("atmfactory", atmfactory);
0
 
rocky_singhAuthor Commented:
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(Client.java:29)

I don't know from where this $Proxy0 is coming.
Can you please help !!!
0
 
objectsCommented:
check ATMFactoryImpl implemts ATMFactory
and check your classpaths are all setup correctly
0
 
rocky_singhAuthor Commented:
Hi Objects,

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

thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now