• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

NX:Stub class not found

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I write a interface DBAccess which extends Remote
and a class DBAccessImpl which implements DBAccess
At last I write a test class Named Server
String hostName ;
try{
LocateRegistry.createRegistry(1099);
DBAccessImpl DBAccess = new DBAccessImpl();
hostName = "localhost";
Naming.rebind("//localhost:1099/DBAccess",DBAccess);
System.out.println("DBAccess rebind");

}
....
when i run . i get these error message like:
java.rmi.StubNotFoundException: Stub class not found: DBAccessImpl_Stub; nested
exception is:
java.lang.ClassNotFoundException: DBAccessImpl_Stub
at sun.rmi.server.RemoteProxy.getStub(RemoteProxy.java:98)
at sun.rmi.server.RemoteProxy.getStub(RemoteProxy.java:55).....
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gy,
Did you run the RMI Compiler (rmic) against your compiled classes?
Regards, Andrew
 
guyue0505
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But in the document which I download from sun:
You must not require the use of an HTTP server.
You must not require the installation of a security manager.
You must provide all classes pre-installed so that no dynamic class downloading occurs.
You must use RMI over JRMP (do not use IIOP)
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gy,
The RMI Compiler is seperate to everything you mentioned.
The RMI Compiler will create the skeleton and stub files for you (actually the skeleton files are not necessary, and you can switch off their creation).
The requirement You must provide all classes pre-installed so that no dynamic class downloading occurs. requires you to bundle the stub files that are created by the RMI Compiler into your jar files.
You said that you wrote a class DBAccessImpl which implements DBAccess - does this class also extend UnicastRemoteObject?
Regards, Andrew
 
guyue0505
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
first thanks you very much.
(the DBAccessImpl extends UnicastRemoteObject of course.)
Second , i run "rmic -d . DBAccessImpl"
and then I write a test class named Client,
and i run Client. it's does Ok
but my question is :
Do i must run "rmic -d ...." before run the server
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gy,
Do i must run "rmic -d ...." before run the server
rmic is a compiler, so you must run it at least once after each time your remote code (DBAccessImpl) changes. It will then create the code necessary to handle RMI, compile it, and delete it.
You can then run the server as many times as you like without doing another recompile.
Regards, Andrew
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic