nadimcse / arit

Automatically exported from code.google.com/p/arit
0 stars 0 forks source link

Arit 0.6 throws NullPointerException on Tomcat 6.0.32 #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
hi,

I'm running Tomcat 6.0.32 on JDK 1.6.0_24-b07 on Windows.

In case I use the 0.6 version of Arit I get a NullPointerException while 
0.6-beta6 works perfectly fine. Pls see the stacktrace below. In both cases I 
used the WAR-version.

In case you need further information pls let me know.

Exception in thread "LeakDetectorTimer" java.lang.NullPointerException
    at com.googlecode.arit.jul.HandlerResourceEnumerator.doNextResource(HandlerResourceEnumerator.java:46)
    at com.googlecode.arit.SimpleResourceEnumerator.nextResource(SimpleResourceEnumerator.java:37)
    at com.googlecode.arit.report.ReportGenerator.generateReport(ReportGenerator.java:169)
    at com.googlecode.arit.jmx.LeakDetector.runDetection(LeakDetector.java:65)
    at com.googlecode.arit.jmx.LeakDetector.access$000(LeakDetector.java:38)
    at com.googlecode.arit.jmx.LeakDetector$1.run(LeakDetector.java:59)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)

cu

thorsten

Original issue reported on code.google.com by thorsten...@gmail.com on 20 May 2011 at 12:27

GoogleCodeExporter commented 9 years ago
Hi Thorsten,

The com.googlecode.arit.jul code was introduced between 0.6-beta6 and 0.6. This 
explains why you are seeing the issue with one version, but not the other.

I had a closer look at how this code behaves in a Tomcat environment, but I was 
unable to reproduce the issue and I don't understand yet how one can get a 
NullPointerException here. On the other hand, since Tomcat installs its own 
java.util.logging.LogManager (called JULI), anyway the JUL plugin in Arit will 
not report anything useful in this environment (for more explanation, see 
http://code.google.com/p/arit/wiki/JULHandler). Therefore, as a workaround you 
can simply remove arit-jul-0.6.jar from WEB-INF/lib to disable this plugin.

To better understand the issue, could you let me know if it occurs only 
sporadically or if it is reproducible (e.g. if it occurs every time Arit is 
started or stopped)?

Andreas

Original comment by andreas.veithen@gmail.com on 22 May 2011 at 2:24

GoogleCodeExporter commented 9 years ago
The Tomcat instance is started from Eclipse and everytime this instance is 
started I get this NullPointerException.

Original comment by thorsten...@gmail.com on 8 Jun 2011 at 11:28

GoogleCodeExporter commented 9 years ago
The issue actually occurs because on Sun JDK 1.6 loggers can be garbage 
collected (i.e. LogManager only keeps weak references to Logger instances). 
This means that the enumeration returned by LogManager#getLoggerNames may 
contain names of loggers that have been garbage collected, and 
LogManager#getLogger will return null for these names.

I think the problem is fixed now:
- When deployed on Tomcat, Arit will now use a plugin specific to Tomcat's 
java.util.logging implementation (JULI).
- The code supporting the standard LogManager now does a null check on the 
return value of LogManager#getLogger.

Original comment by andreas.veithen@gmail.com on 18 Jun 2011 at 6:14