-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Servlet tuning and shut down
PostPosted: Fri May 27, 2011 11:48 am 
Newbie

Joined: Fri May 27, 2011 11:37 am
Posts: 1
Hello, everyone.

I am building a web application that runs in a tomcat container using servlets which use hibernate and c3p0 as a back end.

The vital stats:

Java: 1.6.0_07-b06

Implementation-Title: Hibernate3
Implementation-Version: 3.2.4.sp1
Implementation-Vendor: hibernate.org
Hibernate-Version: 3.2.4.sp1

C3P0 :

Specification-Version: 1.0
Implementation-Vendor-Id: com.mchange
Implementation-Vendor: Machinery For Change, Inc.
Implementation-Version: 0.9.1

=========

I have two questions.

1) I cannot undeploy or reload more than 7 times before I get a perm gen error. This only occurs if I access hibernate, so I know the error is in that portion of the code.

Specifically, my log has the error

SEVERE: A web application registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
May 26, 2011 4:23:07 PM org.apache.catalina.loader.WebappClassLoader clearReferencesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [Timer-4] via the java.util.Timer API but has failed to stop it. To prevent a memory leak, the timer (and hence the associated thread) has been forcibly cancelled.
May 26, 2011 4:23:07 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has failed to stop it. This is very likely to create a memory leak.
May 26, 2011 4:23:07 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but has failed to stop it. This is very likely to create a memory leak.
May 26, 2011 4:23:07 PM org.apache.catalina.startup.HostConfig checkResources


I assume this means that the C3P0 helper threads have not shut down cleanly.

What am I doing wrong? I added the following code to the appropriate servlet:

Code:
   public void destroy() {
      HibernateUtil.getSessionFactory().close();
      super.destroy();
   }


Overriding the servlet's native destroy method should ensure hibernate shuts down when the servlet is unloaded or redeployed. But it doesn't seem to be happening. How do I ensure a clean shutdown?


2) Can anyone point me to some reference material -- books, online links, other -- that will assist me in tuning the hibernate and c3p0 settings in hibernate.cfg.xml? There is the reference manual, of course. I am looking for something that is more involved than a mere tutorial but less comprehensive than the full manual.

This is for an internal system , so it will have very few users. My major concern is to ensure the system will not crash due to a memory leak or some other trivial error that can be easily avoided by getting the settings right.


Respectfully,

Brian P.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.