0

I made a dynamic web project in Eclipse with hibernate frameworks(servlet).
The first run is ok.
But run it for more times, i get this Exception

Tomcat v7.0 Server at localhost, jdk1.7.0_17. 
On Win2007 32 bits with 4GB of RAM
Dharmesh Porwal
  • 1,406
  • 2
  • 12
  • 21
Febin
  • 111
  • 2
  • 9
  • check this out http://stackoverflow.com/questions/11646483/jboss-7-java-lang-outofmemoryerror-permgen-space The same applies to your case – MaVRoSCy Jan 08 '15 at 06:34
  • While this might well be a duplicate of the given question it could also be the hibernate-issue mentioned in may answer and not be related to tomcat in any way... – piet.t Jan 08 '15 at 09:20

2 Answers2

0

This could be happening if you have a low memory allocated for the VM. Increase the memory(PermGen) available for the VM.

http://www.genericarticles.com/mediawiki/index.php?title=How_to_increase_tomcat_memory_inside_eclipse

If you still have an issue after increasing the memory, then attach a profiler and inspect to see if you have any memory leaks.

Tomcat application Profiler for Eclipse indigo

Community
  • 1
  • 1
Balaji
  • 1,009
  • 7
  • 21
0

I can think of two problems, depending on what you mean with "run it for more times":

  • If it is "after multiple deployments" you might have run into menmory-leak with classloading. Tomcat 6 definitely had some trouble with this, don't know for sure about tomcat 7.
  • If it is "after multiple invocations" of the same deployed application this could be a bug in your application with handling the SessionFactory/EntityManagerFactory. As a rule of thumb make sure you only create one SessionFactory/EntityManagerFactory over all the lifetime of your aplpication. Each invocation should only create a Session/EntityManager from the existing factory.
piet.t
  • 11,718
  • 21
  • 43
  • 52