• 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

RMI, dynamically load class into server, rmiregistry CLASSPATH

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.

I've done some RMI examples before but I haven't tried dynamically loading code to server yet. So I looked up RMI tutorial and slightly modified the example. First I started rmiregistry in my home directory (eg. away from CLASSPATH of my two projects), then I created server & client projects. The reason for two projects is to not share CLASSPATH. Then I tried to execute server main() (compute/ComputeEngine.java) but RMI fails to get shared/Compute.java interface (exception & code below). I tried to start registry inside server main() (eg. createRegistry(int) instead of getRegistry(int)) or start rmiregistry program in directory with compiled server classes and server startup worked. However now client main() (client/ComputeLong.java) threw same exception. According to tutorial, rmiregistry shouldn't have access to any CLASSPATH. My goal is to execute class unknown to server (implementing common interface) in server. What am I doing wrong? Thank you.

Server:

compute/ComputeEngine.java:

Client:

client/ComputeLong:

client/LongTask.java

Shared:
shared/Compute.java:

shared/Task.java:


For clarity I omitted policy related files (they work, I tried it with command line settings too). Task and Compute interfaces are copy-pasted between projects but they're same.

This exception is from server project, but it looks exactly same in client (rmi-test-client):

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic