aspose file tools*
The moose likes Applets and the fly likes Logging By Applet Run On Glassfish Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Logging By Applet Run On Glassfish Server" Watch "Logging By Applet Run On Glassfish Server" New topic
Author

Logging By Applet Run On Glassfish Server

George Berish
Greenhorn

Joined: Oct 28, 2004
Posts: 14
Hi,

I auto deploy an Applet as part of an EAR package on a Glassfishv3 server.

On the Glassfish on my local computer (localhost the Applet works works perfectly.

But when I deploy the same package on the same version of Glassfish running on a virtual server I rent from a host. It fails miserably.

Not only does the Applet not show up on its web page, but when I click on the empty area that says "Click Here For Details" ... it locks up the browser.

Snf the messages in gassfish's server logs are useless, so I'd like to add some Log4J tracking.

I have a singleton Servlet deployed with the package that has no problem initializing a Logger.

Then it has has no problem creating my.log and wrting to it.

But I just can't find a way to get the Applet to use that Logger .... or write anything anywhere I can find.

I assume the explanation is the Servlet runs inside the Glassfish's context, so it's allowed to log to <Glassfish_Home>/domains/domain1/logs/server.log or my.log

But the Applet is trapped inside an application sandbox it can't get out of. Or reach outside or to find the initialize Logger

And no.
System.out.printlin() from the Applet doesn't go anywhere either.
But again, form the Servlet, System.out.println () goes to server.log.

I'm thinking it must be possible to initialize Logger programmatically in the Applet's init() method so that it writes to a log file it creates inside the application

... but that seems inelgant because it would reinitialize Logger every time an Applet was launched.

... And I have no idea what grief that would cause under heavy use.

And I just don't know how to get anything except a Servlet to automatically run – Once -- when the package is first loaded.

Obviously I'm floundering (no pun) in glassfish.

Anyone able to point me to a good direction?

I mean I have no idea how to debug my Remote-Only Applet bug if I can't get the Applet to write stuff to me somewhere.

Thanks

George

G
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

The applet runs in the browser (if it runs at all) so you can't hope for it to write to logs on the server. And you are quite wrong that System.out.println from the applet goes nowhere. It goes to the Java console on the machine where the browser is running.

However in your case it looks like the browser isn't loading the applet, so logging isn't likely to help. It sounds more like the browser is unable to load the applet for some reason. Might be because it can't download it, or because it's corrupted on your server, or perhaps for some other reason. I'd suggest checking all of those possibilities.
George Berish
Greenhorn

Joined: Oct 28, 2004
Posts: 14
Hi Paul,

Thank you.
Grin ... Even though your explanation made me feel dumb, it solved my problem
... or more correctly: it let me solve the problem with my coding problem.
Why I didn't know that I already knew that ... I guess I'll never figure out.
[Note to self: Duh!
... of coure Applets run on the browser not the server
... that's why God gave us Applets in the first place!]

In the morning I'm headed to the court to change my name.

xyz

PS: Its kind or incredible, but even though a few hours of web searching found serveal discussions of "logging" from an Applet ... one of them pointed out the obvious ... as you did. thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logging By Applet Run On Glassfish Server