GeeCON Prague 2014*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Stupid deployment question - Again! 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 "Stupid deployment question - Again!" Watch "Stupid deployment question - Again!" New topic
Author

Stupid deployment question - Again!

Kirk Maze
Ranch Hand

Joined: May 14, 2002
Posts: 32
When I've run my RMI server inside my ide, I've had to set a path which told it where to look for my stubs. From the command line, how do I tell the registry where to look for the stubs when my stub is inside a jar file? I can't find any documentation for rmiregistry which indicates it can take any argument except port number.
Thanks,
Kirk Maze


Sun Certified Java Developer<br />Sun Certified Java Programmer
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
Security manager needed?
RMI tutorial
[ October 19, 2002: Message edited by: Thomas Fly ]

Fly by Night Consultants<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr><i>I climbed on the back of a giant albatross<br />which flew through a crack in the cloud<br />to a place where happiness reigned...<br />all year 'round<br />the music played ever so loudly!</i><p><a href="http://thomasfly.com/songs/Traffic/Hole_in_my_Shoe_qt.htm" target="_blank" rel="nofollow">Hole in My Shoe</a><hr></blockquote>
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Thomas has the right links there.
Basically you will include the stubs in both the server and client jars. Dynamic Downloading of Stubs and skeletons makes it a requirement to set a codebase.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Kirk Maze
Ranch Hand

Joined: May 14, 2002
Posts: 32
I haven't articulated my problem well again. There's nothing wrong with my server - if an instance of RMI server is running that knows about the DbEngine stub location, is running, then the server-side I wrote runs fine. Similarly, if the server-side is running fine, the client can hit it fine - all of this works from jarred up solutions from the command line.
What doesn't work from the command line, is the RMI server itself. I can run the RMI server from my IDE, and I can pass it a location of the stub as a classpath, then it runs, and I can run my server side. But from the command line, when I call , I can't pass it the location of the stub, which is now in the jar file, (or if I can, I don't know how). As a consequence, when I run the server-side that I wrote, it throws a huge nested exception. In pertinent part it says:

I hope I'm clear that the only difference between success and failure here is that, when I'm successful, the call to rmiregistry.exe knows about the classpath to the stub (because I'm making that call from inside the ide where it has that classpath). In the failed case, the call to rmiregistry has no path to the stub, so, when the server tries to bootstrap to it, it fails. In both the sucessful and unsuccessful case, the code I wrote is in the same 2 jar files. So this isn't a failure of the client to see the server. Its a failure of the registry to honor the call from the server, apparently only because the registry doesn't know where the stub is located.
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
rmiregistry doesn't take any parameters that I'm aware of- it's just a naming service that (in a production environment) would already be running when you start your server. In my implementation, I try to register my ConnectionFactory, and if that fails (presumably because rmiregistry isn't running), I then start the registry programmatically.
My ConnectionFactory has only one method, getDatabase, which returns a Database remote object (unique to each client):A .jar file is just a compact representation of an "exploded" directory structure, with some limitations (e.g., db.db won't work from within the .jar; it has to be extracted). Use WinZip to look at your .jar file (which is just a .zip file) and make sure that your directory structure is correctly represented
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi Kirk,
in my assignment I tried to avoid all uncertainties with the registry and simply started it programmatically. In other words, my server started its own registry. If the user did not specify a port, the registry started on the default port 1099. And it worked fine.
Hope this helps.
Mag (SCJP/SCJD)


Mag
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
The rmiregisty is of course a system-wide service, but no harm is done (to my knowledge) by "starting" it when it's already running.
Kirk Maze
Ranch Hand

Joined: May 14, 2002
Posts: 32
It worked. I did some final testing on multiple machines last night and this morning, and submitted the darn thing! It was past time - I've had my next project designed in my mind for weeks, and I'm tired of FBN! Thanks to all.
Kirk Maze
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
Great Kirk!
Probably the best criterion for deciding when to submit your project is when you realize that you're sick of working on it
 
GeeCON Prague 2014
 
subject: Stupid deployment question - Again!