my dog learned polymorphism*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes rmi deployment, confirm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "rmi deployment, confirm" Watch "rmi deployment, confirm" New topic
Author

rmi deployment, confirm

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hej
I've been struggling with rmi for a few days now. Today I got it to work, first locally and then remotely. I can't seem to find anywhere the details on what I exactly must have in the server and client.
I made my own silly implementation where I transfer a string from the client to the server who displays it along with the timestamp. I can then retrieve the timestamp and the length of the string from the server. Not very useful
In the server jar I added the class-files for the interface, the remote client (server implementation), the stub from rmic and a class to bind to the server registry (launches the the server implementation). I have a policy file for allowing it all. The rmiregistry, in the server, has to be started with the CLASSPATH set so it can find the classes. The rmiregistry in the client is started with no CLASSPATH content. All this is compiled in the server so all the classes are still in the dev. directory. Anyone I don't need there ? Is the above correct ? Can I skip the steps with rmiregistry and launching the server implementation in the server, i.e. doing it from the client ?
Cheers
Torgny
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

In the server jar I added the class-files for the interface, the remote client (server implementation), the stub from rmic and a class to bind to the server registry (launches the the server implementation). I have a policy file for allowing it all. The rmiregistry, in the server, has to be started with the CLASSPATH set so it can find the classes. The rmiregistry in the client is started with no CLASSPATH content.

It will make it much easier for you and the accessor if you don't use policy file, codebase, classpath setings, or security managers. Note also that rmi registry can be started from the app itself.
Eugene.
[ October 07, 2002: Message edited by: Eugene Kononov ]
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
Hi Eugene,
well ill be glad if i can get rid of the policy file,but if i do that my app just does not seem to like it .. it cant connect to start with .. any sugestion on what i might be doing wrong ??
right now am using policy file both in the client as well as the server.
cheers,
parthi.


Even crazy and silly looking problems are sometimes real.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

well ill be glad if i can get rid of the policy file,but if i do that my app just does not seem to like it

Do you instantiate a security manager within your app? Comment that out if you do.
Eugene.
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
thnx eugene
that sure does the trick

cheers,
parthi.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thx for the reply. So my deployment of this not-so-useful hands-on app is very correct ? What about using codebase, that would make things different ? Anyone have a link or two to a detailed rmi deployment how-to ?
Cheers
/T
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
And another thing, if I deploy the server stuff (without any class to bind to the server registry), how do I handle that from the client, registry and launching of server class(es) ?
/T
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You should include a way to get a hold of the Data (some encapsulating interface) without using RMI at all. Right?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

And another thing, if I deploy the server stuff (without any class to bind to the server registry), how do I handle that from the client, registry and launching of server class(es) ?

I am not sure what exactly you are asking here, but essentially here is what you do:
1. For networked mode, you start a server that controls the database access. The client connects to the server using RMI and uses its services. Since the dynamic stub downloading is not required, simply package the server stubs with the client. Don't bother with policy files, codebases, classpath, and security managers, -- they are not required, they add nothing to design (they are just decorators), and complicate life for you and your accessor. Your server should start as simple as java -jar server.jar, andd the same goes for client.
2. For standalone mode, the client program connects to database directly (the db.db file is local to the client program).
Eugene.
[ October 08, 2002: Message edited by: Eugene Kononov ]
 
Consider Paul's rocket mass heater.
 
subject: rmi deployment, confirm
 
Similar Threads
Problems with Java RMI
RMI from start to finish
Issue about RMI
Restrictions on RMI - what does that mean to me?
HELP: Muilt-Threaded Server