This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: Providing policy file & logging file

 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm curious whether or not people who used RMI for their network included their own policy file within their assignment. Is this necessary? My assignment works fine without a policy file, but i can only start my server on port 1099 which seems like it might be 'policy' related. Does anyone know why this might be?
Also, i've been wondering how people went about seeting up their logging within the project. Do you require that your own logging.properties file be located in the current working directory? or do you trouble the user to specify where the file is? Also how to do you point your logging.properties file to log to a specified file within the logging.properties file? Do you just to this within your code instead of letting the prop file do all the work?
I'm just curious how people went about this and if a certain way is looked down upon by sun. If anyone has any ideas that would be great!
Thanks,
Dave
 
Paul Tongyoo
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dave Knipp:
My assignment works fine without a policy file, but i can only start my server on port 1099 which seems like it might be 'policy' related. ...
Also, i've been wondering how people went about seeting up their logging within the project. Do you require that your own logging.properties file be located in the current working directory? ...
...


Hi Dave--
I had that problem with RMI as well until someone suggested in the forum to first create your registry on a certain point before actualling getting the registry reference to bind the object. For some reason, using these two lines of code instead of just getting the registry right away seemed to let me use any port. I have no idea why this is happening and I do plan on exploring this anomaly further. For clarity, the code is posted below:

About logging, if you check out java.sun.com's tutorial on logging they have a nice section on programmatically configuring your own Logger instance and adding your own Handler objects to it-- effectively bypassing the logging file properties. Just be sure you use the Logger.setUseParentHandlers(false) operation to stop your Logger from using its default handler/levels (I believe the root logger outputs INFO messages to the console) so you can add in your own desired levels.

Regards,
Paul
 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
Thanks for your reply. I tried to get the registry like you said, but now i've run into the problem of looking it up on the client side. Previously i was using Naming.bind() and Naming.lookup(), but now since im not binding via Naming i think i can't lookup it either. How did you look yours up if you bound via the registry object?
Dave
 
Paul Tongyoo
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dave--
You should be able to use either the Naming or Registry interface to lookup your remote object on client-side. The Registry method takes an extra line of code (which is why I do not use that method), since you have to retrieve a reference to the server's registry first, and then lookup the object on that reference. For clarity's sake the code is posted below:

I'm not 100% on using the Registry interface to look up objects, but I believe the above two code fragments are equivalent.
HTH
Regards,
Paul
[ November 17, 2003: Message edited by: Paul Tongyoo ]
[ November 17, 2003: Message edited by: Paul Tongyoo ]
[ November 17, 2003: Message edited by: Paul Tongyoo ]
 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
Thanks again It worked, i think i was forgetting to include the port to lookup on, woops I guess thats a bit necessary, hah.
Thanks,
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic