• 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

Very New to RMI - Help plz - question on NotBoundException

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my first RMI program, and i am running this in a same machine and i'm using jdk 1.5

file name : MethodImpl.java
-----------------------------------
import java.rmi.*;

interface MethodImpl extends Remote
{
double getSqrt(double dbl) throws RemoteException;
}

____________________________________________________

file name : RMIServer.java
----------------------------------------------------------
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;

public class RMIServer extends UnicastRemoteObject implements MethodImpl
{
public RMIServer() throws RemoteException {}
{
System.out.println("The server is instantiated");
}

public double getSqrt(double dbl)
{
return Math.sqrt(dbl);
}

public static void main(String[] args)
{
try
{
RMIServer server = new RMIServer();

Naming.rebind("sqrt",server);
}
catch(Exception ex)
{
System.out.println("Error -- "+ex.toString());
}
}
}
___________________________________________________________

file name : RMIClient.java
--------------------------------------------------------
import java.rmi.*;
import java.rmi.registry.*;

public class RMIClient
{
public static void main(String[] args){
try
{
MethodImpl mthdImpl = (MethodImpl)Naming.lookup("rmi://127.0.0.1/sqrt");
double dbl = mthdImpl.getSqrt(100);
System.out.println("SQRT:"+dbl);
}
catch(Exception ex)
{
System.out.println("Error -- "+ex.toString());
}
}
}
___________________________________________________________

I compiled the above like

javac MethodImpl.java
javac RMIServer.java
javac RMIClient.java

and as a result i got

MethodImpl.class
RMIServer.class
RMIClient.class

then i used rmic compiler to create stub and skeleton like

rmic RMIServer

above action generated only the

RMIServer_stub.class and it doesn't create RMIServer_skeleton.class

but there is no error message.

What may be the problem?
How to create skeleton?



Please help me out
-------------------------------------------------------

Thanks in Advance

Thanigaivel S.

[ October 12, 2005: Message edited by: S Thanigaivel ]

[ October 12, 2005: Message edited by: S Thanigaivel ]
[ October 12, 2005: Message edited by: S Thanigaivel ]
 
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no longer a _skeleton class. (since way back 1.3? or 1.2)
 
S Thanigaivel
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Mr.Edward Harned
-------------------

now, i'm facing a different problem

i compile the RMIServer using rmic compiler as
>rmic RMIServer

then after RMIServer_Stub.class got created

i executed the following cmd

>start rmiregistry

A new blank command prompt window opened

then as i opened another cmd prompt window and executed the RMIClient class file i'm getting the following error

java.rmi.NotBoundException: sqrt

above error was thrown by the following line
MethodImpl mthdImpl = (MethodImpl)Naming.lookup("rmi://127.0.0.1/sqrt");

please help me to clear this error

_________________

Regards,
Thanigaivel
 
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
You need to run the programs in this order -

1.) RMI registry - provides the registry to bind the server to, and that the client looks up the server in.

2.) Server - server starts and binds itself to registry.

3.) Client - client looks up server in registry and gets a reference to the server.
 
S Thanigaivel
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help!

Now I cleared my exceptions
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic