The Artima Developer Community
Sponsored Link

Java Answers Forum
RMI

3 replies on 1 page. Most recent reply: Jan 10, 2003 6:02 AM by Ugo Posada

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
geethavasan

Posts: 12
Nickname: geetha
Registered: Dec, 2002

RMI Posted: Jan 8, 2003 11:14 PM
Reply to this message Reply
Advertisement
hi,
when i execute my client program i am getting the following error.hello client exceptionjava.rmi.NotBoundException: HelloServer

my programs are

//HelloInterface.java
import java.rmi.*;

public interface HelloInterface extends Remote
{
public String sayHello() throws java.rmi.RemoteException;
}

//HelloServer.java

import java.rmi.*;
import java.io.*;
import java.rmi.server.UnicastRemoteObject;
import java.util.*;

public class HelloServer extends UnicastRemoteObject implements HelloInterface
{
public HelloServer() throws RemoteException
{
super();
}

public String sayHello() throws RemoteException
{
return "Hello world , the current system time is " + new Date();
}
}

//HelloClient.java

import java.rmi.*;

public class HelloClient
{
public static void main(String args[])
{
if(System.getSecurityManager() == null)
System.setSecurityManager(new RMISecurityManager());

try
{
HelloInterface obj = (HelloInterface) Naming.lookup("HelloServer");
String message = obj.sayHello();
System.out.println(message);
}
catch (Exception e)
{
System.out.println("hello client exception" + e);
}
}
}

//RegisterIt.java

import java.rmi.*;

public class RegisterIt
{
public static void main(String args[])
{
try
{
HelloServer obj = new HelloServer();
System.out.println("object instantitation" +obj);
Naming.rebind("HelloServer",obj);
System.out.println("HelloServer bound in registry");
}
catch(Exception e)
{
System.out.println(e);
}
}
}

i have generated stubs giving the command as
rmic-v1.2 HelloServer

i have set permissions in java policy file also.

plz help me in finding out what would be the error.

i have also given the command as
rmiregistry -J-Djava.security.policy=registerit.policy

plz help me.

thanks in advance

regards
geetha


Arun

Posts: 2
Nickname: kichu
Registered: Jan, 2003

Re: RMI Posted: Jan 9, 2003 5:13 AM
Reply to this message Reply
Hi Geetha

Check the URL that u are pointing to and the port, See if this is free or no.

geethavasan

Posts: 12
Nickname: geetha
Registered: Dec, 2002

Re: RMI Posted: Jan 9, 2003 11:24 PM
Reply to this message Reply
> Hi Geetha
>
> Check the URL that u are pointing to and the port, See if
> this is free or no.


Hi Arun,
thanks a lot for replying.
but i have set the code base permissions to all permission in java policy file.

Ugo Posada

Posts: 37
Nickname: binaryx
Registered: Dec, 2002

Re: RMI Posted: Jan 10, 2003 6:02 AM
Reply to this message Reply
Guys, remember to enclose your Java code between the
 and 
tags, that provide syntax coloring so the source code is easier to read.

later

Flat View: This topic has 3 replies on 1 page
Topic: StringBuffers Previous Topic   Next Topic Topic: Using String Tokenizer

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use