• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rmi server start

 
friso dejonge
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
when i write my server code in the default package, taking out all package suncertify.db; , everything works fine:
- rmiregistry
- rmic RemoteDataObject
- java RMIServer
then when i put my servercode inside the suncertify.db package i can't get the server up, it complains about:
nested exception is - java.rmi.unmarshallexception
java lang class not found exception: suncertif db.RemoteDataObject_Stub.
Looking in this directory the stub is there.
classpath problem ? How to fix it ?
 
Nate Johnson
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by f dejonge:
[QB]
then when i put my servercode inside the suncertify.db package i can't get the server up, it complains about:
nested exception is - java.rmi.unmarshallexception
java lang class not found exception: suncertif db.RemoteDataObject_Stub.
QB]

How did you create your stub files? You have to specify the complete package name for it to work right. From my dos prompt (at the directory before the suncertify directory) I would use the syntax:
rmic -v1.2 suncertify.server.<file_name>
Does that help at all?
 
friso dejonge
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i created my stubfiles like
rmic suncertify.db.RemoteDataObject
this works fine, they are all there. Also when i add LocateRegistry.createRegistry(1099) in my code it all works fine.
But still why does not it work if i manually start the rmiregistry and then run the server.?
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi F,
You need to start the registry from the directory that actually holds the stubs and class files.
HTH,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4
[ July 26, 2002: Message edited by: Max Habibi ]
 
Nate Johnson
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by f dejonge:
i created my stubfiles like
rmic suncertify.db.RemoteDataObject
this works fine, they are all there. Also when i add LocateRegistry.createRegistry(1099) in my code it all works fine.
But still why does not it work if i manually start the rmiregistry and then run the server.?

Mine works either way. I would leave out the LocateRegistry() line if you are using the rmiregistry command from the command line. At least that is how I had mine working. Are you using Naming.bind() or Naming.rebind()? I believe the rebind method is the one you want.
Not sure what else might be wrong. All my server does is creates a remote factory, rebinds it, and exits. (also LocateRegistry() if I am not running it from command line with rmiregistry.exe)
I am still not sure if I have answered your questions...
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've set classpath to nothing and started the registry in another session. Used to get the exact same unmarshaling error for stubs until I got the codebase setting right.
So it works now and my server successfully binds to the registry, but...
I've seen posts that talk about no codebase setting at all. How do these setups work if there is no codebase? It's been said that the ideal setup would have the registry running with no classpath in an arbitrary directory off in space somewhere.
I'm concerned about specifying a machine-specific codebase setting. "w:/certification/scjd" will not be on the evaluator's machine. Is it OK to have the evaluator specify the codebase?
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Erick -
You need to specify a codebase for your server and provide a policy file when you are downloading classes to the client. If the remote classes are directly available to your client, then you don't need to worry about either one of them.
-BJ
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, BJ! I'll look into this. Too tired tonight to be effective. (too much yardwork)
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did some more reading (from the RMI section of the Java Tutorial) and considered BJs post some more, but some questions remain...
Having a codebase setting for the server seems just fine to me, but how would this translate to the machine the assignment evaluator is using? Would I just specify that the evaluator must provide a codebase, based on where the evaluator puts my server stuff on their machine, when they startup the server?
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just state in your instructions that you are assuming the jar file has been extracted to c:\scjd, and that if they have extracted it elsewhere, they need to take that into account when following your instructions.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, BJ!
So, to make sure I got it... we gotta set a codebase to get stubs to download, but so long as we document our assumptions about the deployment layout, or make it easy for evaluators to introduce their own take on codebase, all is good?
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right. You need the codebase to get stubs downloaded, I think the server will send that info to the client and the client will look ot the location to obtain the classes, but in the case of this assignment there is no requirement for dynamic downloading.
I would word the instructions similar to this:

This should be clear enough, but if you want to make really sure, put another note at the top of your instructions explaining that they should substitute whatever directory they have actually extracted the files to in place of <install-dir>.
[ July 29, 2002: Message edited by: BJ Grau ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again, BJ!
In addition to your posts, I've been doing some RMI-related reading on the train. It's much clearer now -- the reasons for the codebase settiong, and how to have things play well with the submission of the assignment.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic