3

I found this is a well known problem on Tomcat, so I'm trying to solve it on my server.

Deploying/undeploying war files on my Tomcat I often get this alert checking memory leaks:

The following web applications were stopped (reloaded, undeployed), but their
classes from previous runs are still loaded in memory, thus causing a memory
leak (use a profiler to confirm):
/GEKKO
/GEKKO
/GEKKO
/LinkPlatform

This answer https://stackoverflow.com/a/4565522/1061499 suggests to:

Make sure your web application does not use any java classes that are in the web container shared libraries. If you have any shared libraries, make sure there is no strong references to the objects in those libraries

What does it mean? I'm using Maven in my Eclipse project and all dependencies are automatically loaded. But I have to manually add Tomcat libraries in project build path (Server Runtime). Is this the problem? Are Tomcat jars "shared libraries"?

Community
  • 1
  • 1
davioooh
  • 23,742
  • 39
  • 159
  • 250

1 Answers1

3

Jars that are provided by Tomcat at runtime should be scoped as provided if you need them to compile but expect the Tomcat container to provide them at runtime, e.g.

  <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
  </dependency>

(version is just something I threw in there... use whatever is appropriate).

davioooh
  • 23,742
  • 39
  • 159
  • 250
spudone
  • 1,267
  • 7
  • 10