🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #448

Re: RMI

#448
From: Oliver Young
Date: Tue, 19 Aug 2003 09:00
106 lines
4234 bytes
Something strange happend with source code formatting so I'm reposting it:

Here is source code of my class, I've removed everything irrelevant for
RMI and same exception still occurs:

package dory2;
import java.security.*;
import java.security.cert.*;
import java.rmi.*;
import java.rmi.server.*;

public class DoryMain {
  private boolean doExecute = true;
  //This method below should be called as remote procedure
  public void stopDory() {
    System.out.println("Dory stopped.");
    doExecute = false;
    return;
  }

  public DoryMain() {
    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new RMISecurityManager());
    }

    String name = "rmi://localhost:1099/StopDory";
    try {
      StopDoryIntf rmi = new StopDoryEngine(this);
      Naming.rebind(name, rmi);
      System.out.println("StopDoryEngine bound");
    } catch (Exception e) {
      System.err.println("StopDoryEngine exception: " + e.getMessage());
      e.printStackTrace();
    }

    while (doExecute) {
  //do something before someone calls stopDory from the outside (of my app)
    }
  }

  public static void main(String[] args) {
    DoryMain dm = new DoryMain();
  }

}

This is interface:

package dory2;

import java.rmi.*;

public interface StopDoryIntf extends Remote {
  public void stopDory() throws RemoteException;
}

And this class:

package dory2;

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

public class StopDoryEngine extends UnicastRemoteObject implements
StopDoryIntf{
  private DoryMain dory = null;

  public StopDoryEngine() throws RemoteException {
    super();

    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new RMISecurityManager());
    }
  }

  public StopDoryEngine(DoryMain dory) throws RemoteException {
    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new RMISecurityManager());
    }
    this.dory = dory;
  }

  public void stopDory() {
    dory.stopDory();
  }

}

The exception is:

java.lang.NoClassDefFoundError: dory2/StopDoryIntf at
java.lang.ClassLoader.defineClass0(Native Method) at
java.lang.ClassLoader.defineClass(ClassLoader.java:502) at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at
java.net.URLClassLoader.defineClass(URLClassLoader.java:250) at
java.net.URLClassLoader.access$100(URLClassLoader.java:54) at
java.net.URLClassLoader$1.run(URLClassLoader.java:193) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:186) at
java.lang.ClassLoader.loadClass(ClassLoader.java:299) at
java.lang.ClassLoader.loadClass(ClassLoader.java:292) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) at
java.lang.ClassLoader.loadClass(ClassLoader.java:255) at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)Exception in
thread "main"
Technical Details
Message-ID: <3f41e794$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!newsfeed.news2me.com!elnk-nf2-pas!newsfeed.earthlink.net!sjc70.webusenet.com!news.webusenet.com!pd2nf1so.cg.shawcable.net!residential.shaw.ca!news-out.superfeed.net!propagator2-maxim!news-in.superfeed.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f3b90c4$1@newsgroups.borland.com> <3f3e844b$1@newsgroups.borland.com> <3f40a50c@newsgroups.borland.com> <3f41a123$1@newsgroups.borland.com> <3f41e5b2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,304739c9281f7628
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2003-08-19 02:09:28 PST
From: "Oliver Young" <no@spam.please>
Newsgroups: borland.public.jbuilder.java.api
References: <3f3b90c4$1@newsgroups.borland.com> <3f3e844b$1@newsgroups.borland.com> <3f40a50c@newsgroups.borland.com> <3f41a123$1@newsgroups.borland.com> <3f41e5b2@newsgroups.borland.com>
Subject: Re: RMI
Date: Tue, 19 Aug 2003 11:00:56 +0200
Lines: 108
Organization: None
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 193.138.1.66
Message-ID: <3f41e794$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061283732 193.138.1.66 (19 Aug 2003 02:02:12 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!newsfeed.news2me.com!elnk-nf2-pas!newsfeed.earthlink.net!sjc70.webusenet.com!news.webusenet.com!pd2nf1so.cg.shawcable.net!residential.shaw.ca!news-out.superfeed.net!propagator2-maxim!news-in.superfeed.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail