Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rmi deployment, confirm

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx eugene
that sure does the trick

cheers,
parthi.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should include a way to get a hold of the Data (some encapsulating interface) without using RMI at all. Right?
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic