• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic