users@glassfish.java.net

WebappClassLoader unable to load resource [java.util.logging.LogRecord]

From: <glassfish_at_javadesktop.org>
Date: Fri, 10 Sep 2010 23:41:49 PDT

Hello,


Here's the siuation:
GlassFish Server Open Source Edition 3.0.1 (build 22), running under Java 1.6
Oracle 10g database, with JDBC classes in lib/ext directory
Web Application

We have created a custom java.util.logging.Handler (attached) to log records in a database. At context initialize event of the web application, we setup logging
by calling SetupLogging.setupLogging(jndiDataSource) (attached). At context destroy, we call SetupLogging.destroyLogging

Many of our classes in the application use this logger like this:

protected[b] final static[/b] Logger mylogger = Logger.getLogger(IncomingMessageProcessorBase.class.getName());

This results in the following messages in glassfish log files:

[#|2010-09-10T15:18:05.205+0300|SEVERE|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadName=Thread-1;|java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [java.util.logging.LogRecord], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1367)
                at com.netu.lib.logging.DBLogHandler.publish(DBLogHandler.java:113)
                at java.util.logging.Logger.log(Logger.java:458)
                at java.util.logging.Logger.doLog(Logger.java:480)
                at java.util.logging.Logger.log(Logger.java:503)
                at org.cpcs2.crenet.monitor.listeners.OutgoingMessageListener.messagesFound(OutgoingMessageListener.java:56)
                at org.cpcs2.crenet.monitor.DBMonitor$DBMonitorTask.run(DBMonitor.java:175)
                at java.util.TimerThread.mainLoop(Timer.java:512)
                at java.util.TimerThread.run(Timer.java:462)
|#]


However, if we change the logger to an instance variable, all errors go away:
[b]protected Logger mylogger = Logger.getLogger(this.getClass().getName());[/b]

What is the deal here? Any decent java developer knows that loggers should be static. NetBeans even has a hint for such cases. However, it seems that we are doing something that Glassfish can't handle.

Any help to solve this problem would be greatly appreciated.

C.
[Message sent by forum member 'chris08']

http://forums.java.net/jive/thread.jspa?messageID=482400