title: tomcat java.util.logging process
body: <p>I have a linux (ubuntu) server running tomcat7. The server has 1GB of ram, and I am  getting heap space errors thrown from java.</p>
  <p>Basically what is happening, is that my tomcat server (running my servlet code) is throwing exceptions because there is no more memory to allocate. My code is pretty lean, so I don't think that is the problem.</p>
  <p>When I look at htop, I see a lot of java logging processes, I see about 30 of these  processes:</p>
  <pre><code>ps ax | grep java
   7412 pts/0    Sl     0:02 /usr/bin/java -Djava.util.logging.config.file=/usr/share/tomcat/apache-tomcat-7.0.29/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/tomcat/apache-tomcat-7.0.29/endorsed -classpath /usr/share/tomcat/apache-tomcat-7.0.29/bin/bootstrap.jar:/usr/share/tomcat/apache-tomcat-7.0.29/bin/tomcat-juli.jar -Dcatalina.base=/usr/share/tomcat/apache-tomcat-7.0.29 -Dcatalina.home=/usr/share/tomcat/apache-tomcat-7.0.29 -Djava.io.tmpdir=/usr/share/tomcat/apache-tomcat-7.0.29/temp org.apache.catalina.startup.Bootstrap start
   7426 pts/0    D+     0:00 grep --color=auto java
  25937 ?        Sl    13:12 /usr/bin/java -Djava.util.logging.config.file=/usr/share/tomcat/apache-tomcat-7.0.29/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/tomcat/apache-tomcat-7.0.29/endorsed -classpath /usr/share/tomcat/apache-tomcat-7.0.29/bin/bootstrap.jar:/usr/share/tomcat/apache-tomcat-7.0.29/bin/tomcat-juli.jar -Dcatalina.base=/usr/share/tomcat/apache-tomcat-7.0.29 -Dcatalina.home=/usr/share/tomcat/apache-tomcat-7.0.29 -Djava.io.tmpdir=/usr/share/tomcat/apache-tomcat-7.0.29/temp org.apache.catalina.startup.Bootstrap start
  </code></pre>
  <p>These java processes slowly leaks memory over time, and because I only have 1gb of ram to play with my tomcat server starts throwing heap space exceptions.</p>
  <p>I have fiddled with log4j (but it should be turned off) and I have done all I can to turn off logging in configs I can find.</p>
  <p>Any help would be great,  I just need to get rid of these processes - they are way to greedy. Thanks!</p>
  <p>~ Dan</p>
  <p>EDIT: MORE INFO:</p>
  <p>This is probably a big enough hint to solve this one entirely - I checked some of the startup debug and came up with this:</p>
  <pre><code>    Oct 02, 2012 8:50:08 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
  
  SEVERE: The web application [/NMVServer] appears to have started a thread named [http-bio-8080-exec-53] but has failed to stop it. This is very likely to create a memory leak.
  Oct 02, 2012 8:50:08 AM org.apache.catalina.loader.WebappClassLoader 
  clearReferencesThreads
  
  SEVERE: The web application [/NMVServer] appears to have started a thread named [http-bio-8080-exec-54] but has failed to stop it. This is very likely to create a memory leak.
  Oct 02, 2012 8:50:08 AM org.apache.catalina.loader.WebappClassLoader 
  clearReferencesThreads
  
  SEVERE: The web application [/NMVServer] appears to have started a thread named [http-bio-8080-exec-62] but has failed to stop it. This is very likely to create a memory leak.
  Oct 02, 2012 8:50:08 AM org.apache.catalina.loader.WebappClassLoader 
  clearReferencesThreads
  
  SEVERE: The web application [/NMVServer] appears to have started a thread named [http-bio-8080-exec-64] but has failed to stop it. This is very likely to create a memory leak.
  </code></pre>
  <p>One problem with leaks that I found is due to a bug with the JDBC Driver <a href="http://bugs.mysql.com/bug.php?id=36565" rel="nofollow noreferrer">http://bugs.mysql.com/bug.php?id=36565</a> according to a couple of forums. That solves another message I was getting.</p>
  <p>I have been looking around and I have found this which is quite useful:</p>
  <p><a href="http://wiki.apache.org/tomcat/MemoryLeakProtection" rel="nofollow noreferrer">http://wiki.apache.org/tomcat/MemoryLeakProtection</a></p>
  <p>Now I am just trying to work through all your advise thanks heaps!</p>
  <p>~ Dan</p>