Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes packaging stubs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "packaging stubs" Watch "packaging stubs" New topic
Author

packaging stubs

Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

Hi All,

About the packaging of the stub classes in the application.
I have a default rmi package, foo.boo.rmi where I have the remote interfaces.
Then I have the server side rmi package, foo.boo.rmi.server, where I have the rmi implementation classes.
When I run rmic for Java 5 platform, it generates the stub classes for the above remote implementation classes.
At this point, I create another package, foo.boo.rmi.client and I copy the stub classes in this new package.

What do you think, is this packaging of the stubs correct?

Thanks,

Romeo


SCJP 1.4, SCJD, OCE EJBD 6
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi Romeo,

You don't need to do this, you only need to (re) compile your remote classes with the rmic with the output directory in the same directory where you keep your (compiled) classes.

Regards,
M


SCJP, SCJD, SCWCD, OCPJBCD
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

Hello Mihai,

You are correct in this case because our assignment does not requests to split between server code and client code.
But anyway, I have three types of packages in my application, so that anyone wants to split client/server code, it can do it veary easily. (I have read in this forum that a few years ago, this was a requirement, to have two jars, client and server).
So I have the common package holding the interfaces (this package goes both on client and server sides), the server package holding local implementations and client package holding service layer implementations.
What basically I don't know, is if the stub generated by Java 5 is at the same time stub and skeleton, or just stub... So that if I would split the jars in client/server, this stubs would be only on client side, or on both sides (client and server).
Or I should not bother, and drop all rmi code in only one package?

Romeo

[ May 06, 2007: Message edited by: Romeo Son ]
[ May 06, 2007: Message edited by: Romeo Son ]
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi Romeo

I think that you don't need to care about the client/server splinting - as far as you pack them in two different packages. More you can let the stub (rmic generated classes) files on both sides because on the run time the client obtains its stub from the rmi registry. At least this is my RMI understanding.

Regards,
M
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

Yes,

I have read the RMI codebase tutorial in the week-end , and here is what I have understood.
The client obtains the stub reference from rmiRegsitry. First, it looks in its local classpath for the stub class definition. If it cannot find it, the stub reference has annotated the url where the class definition can be downloaded.
So, to avoid this downloading, you must package the stub in the client.

I hope my understanding is correct, and I don't fool anybody here...
Lucy Hummel
Ranch Hand

Joined: Apr 07, 2005
Posts: 232
Hi,

I do not know why you want to provide stubs in your submission.

My assignment does not require it and my runme.jar works without stubs.

So, may I ask why you take such big care about stubs?


----------------------------------<br />| SCJP, SCWCD, SCBCD, SCEA, SCJD |<br />----------------------------------
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi Guys,

I don't know how is on you but in my specification I have a point called : Restrictions on RMI and this point contains something like this :

You must provide all classes pre-installed so that no dynamic class downloading occurs


Even if I'll like to use dynamic (proxy) stub generation the must clause constrains me to not to do it. Is a hard and unfair world out there.

Romeo, even is the jar separation has a practical advantage I think that it goes over the certification purpose, but if you think you can mention this in your choiches.txt file.

Regards,
M
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

Hi All,

Hummel,
Mihai has just answered your question.

Mihai,
Thanks for your reply.

Regards,
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Hummel Lucy:
Hi,

I do not know why you want to provide stubs in your submission.

My assignment does not require it and my runme.jar works without stubs.

So, may I ask why you take such big care about stubs?


I know of one person who got 0 for the server implementation because he did not use rmic to create the stubs.

My requirements stated that you must provide all classes pre-installed so that no dynamic class downloading occurs. If you do not create the stub class using rmic then your program will generate them on the fly thus violating this requirement.

See towards the end of this thread, I had a brief discussion about this very topic a few months ago:


http://www.coderanch.com/t/188775/java-developer-SCJD/certification/Building-ant


SCJP<br />SCJD
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

Mark,

Did you have separate rmi packages for server side and client side?
I would like to make it clear by package names who is my client and who is my server.
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Romeo Son:
Mark,

Did you have separate rmi packages for server side and client side?
I would like to make it clear by package names who is my client and who is my server.


I just had the one package for all the networking code called remote. My packages were db, gui, local and remote. Local contained my business logic objects (3 tier approach with Facade object) and remote contained the RMI wrappers for the local package (and the remote server object too). Dividing the client and server code into seperate packages would also be a good approach if you are more comfortable with that structure.
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

Mark,

Thanks for your reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: packaging stubs
 
Similar Threads
Running a RMI Application
Unable to find Skeleton in the rmi invokation
RMIC
stubs
where's the "sharpen your pencil" answer?