[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-ssl] NullPointerException in java.rmi.server.UnicastRemoteObject

I get a NullPointerException when I tried to do
UnicastRemoteObject.exportObject(this) in the SSLHelloClient demo.
This is the code for the SSLHelloClient.java with my modifications:

package demo.rmi;

import java.rmi.*;
import java.rmi.server.*;

import iaik.security.ssl.*;

 * This is the client part of the demo, it simply invokes
 * a method on a remote object.

//****NOW IMPLEMENTS java.rmi.Remote
public class SSLHelloClient implements java.rmi.Remote {

  public SSLHelloClient() {
    // empty

   * This method creates a reference of a class which implements
   * the SSLHello interface and invokes the remote method.
  public String remoteInvoke() {
    String remoteMessage;
    try {

      //***THIS IS THE LINE I ADDED*****

      // try to get a reference of 'SSLHelloServer' where the RMI
       // runs on the localhost
     SSLHello obj = (SSLHello)Naming.lookup("//localhost/" +

     // invoke method sayHello() on the remote object
     remoteMessage = obj.sayHello();

   } catch (Exception ex) {
     System.out.println("SSLHelloClient: an exception occurred:");

     // in case of an error
     remoteMessage = "ERROR: " + ex.toString();

   return remoteMessage;

  public static void main(String[] argv){
    SSLRMIUtil.setSSLSocketFactory(true, false);

    // create a new client object
    SSLHelloClient client = new SSLHelloClient();
    // invoke the remote method
    String remoteMessage = client.remoteInvoke();
    // display teh remote method
   System.out.println("Message from RMI Server: "+remoteMessage);

And this is the output:
ssl_debug(2): Sending client_key_exchange handshake message (1024
ssl_debug(2): Sending certificate_verify handshake message...
ssl_debug(2): Sending change_cipher_spec message...
ssl_debug(2): Sending finished message...
ssl_debug(2): Received change_cipher_spec message.
ssl_debug(2): Received finished message.
ssl_debug(2): Session added to session cache.
ssl_debug(2): Handshake completed.
Creating new SSL server socket on port 0...
SSLHelloClient: an exception occurred:
java.rmi.server.ExportException: Unable to create remote reference;
nested exception is:

        at demo.rmi.SSLHelloClient.remoteInvoke(SSLHelloClient.java:73)
        at demo.rmi.SSLHelloClient.main(SSLHelloClient.java:95)
Message from RMI Server: ERROR: java.rmi.server.ExportException: Unable
to create remote reference; nested exception is:

The SSLHelloClient runs OK without the modifications. I need to export
the object becouse I want to make it available to receive incoming
calls. I'm using Sun's JDK 1.1.7.

Does anybody have a clue as to what's happening? Your help would be
greatly appreciated.

Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-ssl/sslthreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-ssl