I modified the code a bit more to get more insight. Things are getting
even stranger:

        private static long logCount;
        private static Logger log;
        static {
                log = Logger.getLogger(TimerServiceImpl.class);
                threadGroup = new ThreadGroup("VincentTimer");
                logCount++;
                System.out.println("log = "+log);
        }

      run(){
                        int duration = (int)(executionEnd-executionStart);
                        if (log==null)
                                System.out.println("LOG IS NULL!!! 
("+logCount+")");
                        else{
                                logCount++;
                                if (logCount==1)
                                        System.out.println("FIRST LOG ATTEMPT");
                                if (logCount/10*10==logCount)
                                        System.out.println(""+logCount+" log 
attempt");
                        }
                        if (/*log!=null && */log.isDebugEnabled())
                                log.debug("Timer execution lasted: "+duration);
}

output:
....
Apr 26, 2006 5:08:51 PM org.apache.catalina.loader.WebappClassLoader
validateJarFile
INFO: validateJarFile(/opt/web/webapps/ROOT/WEB-INF/lib/servlet-api.jar)
- jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending
class: javax/servlet/Servlet.class
log = [EMAIL PROTECTED]
10 log attempt
20 log attempt
30 log attempt
40 log attempt
50 log attempt
60 log attempt
70 log attempt
[ No configuration properties found for configuration jacorb ]
[ No configuration properties found for configuration jacorb ]
Initializing Log4jInit-Servlet.
80 log attempt
[ No configuration properties found for configuration jacorb ]
90 log attempt
Apr 26, 2006 5:09:05 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8000
Apr 26, 2006 5:09:06 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 26, 2006 5:09:06 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/83  config=null
Apr 26, 2006 5:09:06 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
100 log attempt
Apr 26, 2006 5:09:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 16939 ms
[ No configuration properties found for configuration jacorb ]
110 log attempt
[ No configuration properties found for configuration jacorb ]
[ No configuration properties found for configuration jacorb ]
[ No configuration properties found for configuration jacorb ]
120 log attempt
130 log attempt
140 log attempt
150 log attempt
160 log attempt
170 log attempt
180 log attempt
190 log attempt
200 log attempt
210 log attempt
220 log attempt
230 log attempt
240 log attempt
250 log attempt
<--- shutdown
LOG IS NULL!!! (259)
Exception in thread "Thread-1" java.lang.NullPointerException
        at 
de.friendscout.generic.services.timer.TimerServiceImpl.run(TimerServiceImpl.java:241)
        at java.lang.Thread.run(Thread.java:595)

Obviously the content of the log variable is getting null. Strange
enough it doesn't happen under tomcat 5.0 with the same jvm, so it's
probably not a java bug. There is also no log=null in the code. The
only thing I can think of is change of the classloader, so old
instances become invalid, is there a chance log4j is loaded via
another classloader (both log4j and my code are in jars in
WEB-INF/lib) ?

More ideas ? :-)

regards
Leon

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to