• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

how to load class dynamically from another location In RMI

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FIRST I START WEB SERVER in (download directory) first window
1) ---> java NanoHTTPD 8080


then i start rmi registry ( second window)(RMIDIR Directory)
2) ---->RMIREGISTRY

then i start Server (Third window) (Server Directory)
3) ---->java -Djava.rmi.server.codebase=http://localhost:8080/ CalcServer
In serever directory

three file
calc.java(interface)
calcimpl.java
calcserver.java


4)In client directory......
javac -cp (path of server ) CalcClient.java
AND Run
java CalcClient



it will give Exception class not found.....
If i manually copy Calc.class file in client directory....then program success fully run...........
so any body know HOW THE DYNAMIC DOWNLOADING is done.......
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Dashang!

Champion, I myself have never done this, but it looks like it is not complicated. Please take a look at Dynamic code downloading using RMI tutorial, which I think might be helpful.

Another tip I'd like to ask you, whenever you post code, please post it between the Code tags. It makes the post more readable!

You can edit your post to include these tags by clicking on the button.
 
dashang trivedi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir....thank you for reply.......
i have already...seen rmi dynamic class loading.............


but i am not finding the solution, .......please tell me how to do..........
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dashang,

Can you let me know the contents fetched from location http://localhost:8080/ CalcServer.

3) ---->java -Djava.rmi.server.codebase=http://localhost:8080/ CalcServer

The codebase property should return the jars/classes files which are downloaded to client system on remote object lookup.

 
dashang trivedi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CalcServer.java file..........

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The posted code shows:



But the server was started as:


So which is it - default port 80 or changed port 8080

Bill
 
dashang trivedi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for RMI i need A WEB SERVER .......
so web server(java NanoHTTPD 8080 ) is started on 8080 port.......

Now from server machine codebase pass to WEBSERVER.....and it will BIND TO RMI REGISTRY.......

So my port is 8080.........

 
Abhijeet Nalawade
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dashang,

Can you implement small modification to class CalcSever

//Code to Replace

//New Code

I tried the same locally it worked, hope the same is the case with you too.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!