Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Logging By Applet Run On Glassfish Server  RSS feed

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 23640
48
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!