| Author |
how to load class dynamically from another location In RMI
|
dashang trivedi
Greenhorn
Joined: Mar 01, 2010
Posts: 26
|
|
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.......
|
 |
Roberto Perillo
Bartender
Joined: Dec 28, 2007
Posts: 2212
|
|
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.
|
Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
|
 |
dashang trivedi
Greenhorn
Joined: Mar 01, 2010
Posts: 26
|
|
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..........
|
 |
Abhijeet Nalawade
Greenhorn
Joined: Apr 01, 2007
Posts: 20
|
|
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
Joined: Mar 01, 2010
Posts: 26
|
|
CalcServer.java file..........
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12269
|
|
The posted code shows:
But the server was started as:
So which is it - default port 80 or changed port 8080
Bill
|
Java Resources at www.wbrogden.com
|
 |
dashang trivedi
Greenhorn
Joined: Mar 01, 2010
Posts: 26
|
|
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
Joined: Apr 01, 2007
Posts: 20
|
|
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.
|
 |
 |
|
|
subject: how to load class dynamically from another location In RMI
|
|
|