From: LC's No-Spam Newsreading account on
On Wed, 23 Dec 2009, LC's No-Spam Newsreading account wrote:
> On Fri, 18 Dec 2009, markspace wrote:
>
>> Either use a SocketHandler in you app to send logs directly to the server,

> I've looked up SocketHandler's and found on Sun Tech Tips a simple LogServer,
> which listens on ANOTHER port of my machine (5000).

> I modified my servlet (see thread) to log messages on the socket handler.
> I then modified my applet to also log messages on the socket handler.

> [...] from the appletviewer [...]
> I get "access denied (java.util.logging.LoggingPermission control)"

> what's wrong with permissions ?

Well, I found it. NOTHING was wrong with permissions !

I was simply misled by the way the log server worked. Since it did work
running the test exerciser IN SEQUENCE from two hosts, I assumed it
could share port 5000 between n>1 connections.

This is instead not the case ! If the servlet connects to port 5000 of
the log server (and remains running as it should be), the applet can't
connect.

I spent most of the morning playing with the java.policy file to grant
the logging permission to the applet (testing it with the appletviewer),
but finally found some old notes of mine, which said that java.policy is
unnecessary when the applet is signed (as it is) and runs in the
browser.

So I replaced the stdout messages with popups, and saw that the applet
was not denied by the log server, and did issue log messages, simply
they weren't received !

Or actually, under particular conditions, they were received, but the
servlet one weren't. The first app which got hold of port 5000
controlled the log server.

The solution (to the logging issue ... the debugging of the real
problem will come later using the log files, I hope) has been to have
two separate log servers on port 5000 and 5001, and having servlet and
applet using separate log ports !

(probably I'd write a little [Fortran, do not laugh] utility to merge
the two log files based on time stamps !)

--
----------------------------------------------------------------------
nospam(a)mi.iasf.cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.