• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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):

 
On my planet I'm considered quite beautiful. Thanks to the poetry in this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic