|
Hi,
I run an web application which uses spring, hibernate, apache-cxf and the quartz scheduler which is referenced by spring. The webapp work as it should, but on shutdown or restart the apache tomcat server I always get following output. The webapp is not stopped and I have to kill the process manually. How can I solve this? Thank you, Alex from catalina.out Sep 16, 2010 3:19:13 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/erv] 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. Sep 16, 2010 3:19:13 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/erv] appears to have started a thread named [schedulerFactoryBeanERV_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Sep 16, 2010 3:19:13 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/erv] appears to have started a thread named [schedulerFactoryBeanERV_Worker-2] but has failed to stop it. This is very likely to create a memory leak. --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
> From: Alex [mailto:[hidden email]]
> Subject: How to solve "To prevent a memory leak" > The webapp work as it should, but on shutdown or restart the apache > tomcat server I always get following output. > The webapp is not stopped and I have to kill the process manually. > How can I solve this? Fix your webapp to properly dispose of any threads it starts. Since your webapp started them, it's up to your webapp to stop them. You probably want to use an appropriate lifecycle listener (as defined in the servlet spec) to do the necessary housekeeping. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by Alex-577
On 16.9.2010 15:32, Alex wrote:
> I run an web application which uses spring, hibernate, apache-cxf and > the quartz scheduler which is referenced by spring. > > The webapp work as it should, but on shutdown or restart the apache > tomcat server I always get following output. > > The webapp is not stopped and I have to kill the process manually. > > How can I solve this? Are you using connection pooling provided by tomcat? Did you put MySQL driver to $TOMCAT/lib or $TOMCAT/webapps/xxx/lib? Or both? If you are using connection pooling keep your driver just in $TOMCAT/lib folder. If threads schedulerFactoryBeanERV_Worker-x, are created by Quartz, find how can you stop them, and to that with ContextListener you will register in web.xml. Also, read http://wiki.apache.org/tomcat/OutOfMemory. Regards, Ognjen --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
Thank for your response!
The MySql driver is in $TOMCAT/webapps/xxx/lib. I using Hibernate as OMR Mapper with Spring 3.0, here my hibernateApllicationContext.xml (partial) <bean id="datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${db.driverclass}" /> <property name="jdbcUrl" value="${db.jdbcurl}" /> <property name="user" value="${db.user}" /> <property name="password" value="${db.password}" /> <property name="acquireIncrement" value="1" /> <property name="idleConnectionTestPeriod" value="300" /> <property name="initialPoolSize" value="0" /> <property name="minPoolSize" value="3" /> <property name="maxPoolSize" value="10" /> <property name="maxIdleTime" value="600" /> <property name="maxStatements" value="50" /> <property name="preferredTestQuery" value="Select 1"/> <property name="maxConnectionAge" value="3600"/> <property name="acquireRetryAttempts" value="60"/> <property name="testConnectionOnCheckout" value="true"/> </bean> How can I search the ServletContext for specific objects? Alex Am 2010-09-16 15:43, schrieb Ognjen Blagojevic: > On 16.9.2010 15:32, Alex wrote: >> I run an web application which uses spring, hibernate, apache-cxf and >> the quartz scheduler which is referenced by spring. >> >> The webapp work as it should, but on shutdown or restart the apache >> tomcat server I always get following output. >> >> The webapp is not stopped and I have to kill the process manually. >> >> How can I solve this? > > Are you using connection pooling provided by tomcat? Did you put MySQL > driver to $TOMCAT/lib or $TOMCAT/webapps/xxx/lib? Or both? If you are > using connection pooling keep your driver just in $TOMCAT/lib folder. > > If threads schedulerFactoryBeanERV_Worker-x, are created by Quartz, > find how can you stop them, and to that with ContextListener you will > register in web.xml. > > Also, read http://wiki.apache.org/tomcat/OutOfMemory. > > Regards, > Ognjen > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by Alex-577
I know there was a issue in older versions of tomcat that didn't
release the mysql driver even if the driver wasn't referenced. What version are you runnning? Wes --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by Alex-577
On 16.9.2010 16:04, Alex wrote:
> The MySql driver is in $TOMCAT/webapps/xxx/lib. > I using Hibernate as OMR Mapper with Spring 3.0, here my > hibernateApllicationContext.xml (partial) > <bean id="datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource" Check with c3p0 documentation how to unregister driver, or see link I provided earlier. > How can I search the ServletContext for specific objects? You don't. ServletContext just provide you a method that will be invoked by Tomcat just before context destroy (e.g. application stops or reloads). At that point you should stop started threads. Quartz hopefully provides API to do that. Regards, Ognjen --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by Caldarale, Charles R
It seem that moving the MySql driver to $tomcat/lib solves the problem
with the jdbc connection, buut the problem with quartz still exists. I'm using tomcat 6.0.29 I wrote a listener : public class ServletContextAttribListener implements ServletContextListener, ServletContextAttributeListener { public void contextInitialized(ServletContextEvent e) { System.out.println("Context "+ e.getServletContext() +" initialized"); } public void contextDestroyed(ServletContextEvent e) { System.out.println(e.getServletContext().toString()); } public void attributeAdded(ServletContextAttributeEvent e) { System.out.println("Added attribute "+ e.getName()+" with value "+e.getValue()); } public void attributeRemoved(ServletContextAttributeEvent e) { System.out.println("Removed attribute "+ e.getName()+" with value "+e.getValue()); } public void attributeReplaced(ServletContextAttributeEvent e) { System.out.println("Replaced attribute "+ e.getName()+" with value "+e.getValue()); } } to check what is loaded but all what comes out is: Added attribute org.springframework.web.context.support.ServletContextScope with value org.springframework.web.context.support.ServletContextScope@13c2d7f Added attribute org.springframework.web.context.WebApplicationContext.ROOT with value Root WebApplicationContext: startup date [Thu Sep 16 16:32:12 CEST 2010]; root of context hierarchy Context org.apache.catalina.core.ApplicationContextFacade@ec0b80 initialized Alex Am 2010-09-16 15:37, schrieb Caldarale, Charles R: >> From: Alex [mailto:[hidden email]] >> Subject: How to solve "To prevent a memory leak" >> The webapp work as it should, but on shutdown or restart the apache >> tomcat server I always get following output. >> The webapp is not stopped and I have to kill the process manually. >> How can I solve this? > Fix your webapp to properly dispose of any threads it starts. Since your webapp started them, it's up to your webapp to stop them. You probably want to use an appropriate lifecycle listener (as defined in the servlet spec) to do the necessary housekeeping. > > - Chuck > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by Alex-577
See the following Wiki article on how to use Hibernate and Tomcat's pooling.
http://wiki.apache.org/tomcat/TomcatHibernate As another person said, make sure you have a recently updated MySQL driver. I believe anything >= 5.1.11 solves a threading issue that was reported on their (MySQL's) bug tracking database. . . . just my two cents. /mde/ ----- Original Message ---- From: Alex <[hidden email]> To: [hidden email] Sent: Thu, September 16, 2010 7:04:38 AM Subject: Re: How to solve "To prevent a memory leak" Thank for your response! The MySql driver is in $TOMCAT/webapps/xxx/lib. I using Hibernate as OMR Mapper with Spring 3.0, here my hibernateApllicationContext.xml (partial) <bean id="datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${db.driverclass}" /> <property name="jdbcUrl" value="${db.jdbcurl}" /> <property name="user" value="${db.user}" /> <property name="password" value="${db.password}" /> <property name="acquireIncrement" value="1" /> <property name="idleConnectionTestPeriod" value="300" /> <property name="initialPoolSize" value="0" /> <property name="minPoolSize" value="3" /> <property name="maxPoolSize" value="10" /> <property name="maxIdleTime" value="600" /> <property name="maxStatements" value="50" /> <property name="preferredTestQuery" value="Select 1"/> <property name="maxConnectionAge" value="3600"/> <property name="acquireRetryAttempts" value="60"/> <property name="testConnectionOnCheckout" value="true"/> </bean> How can I search the ServletContext for specific objects? Alex Am 2010-09-16 15:43, schrieb Ognjen Blagojevic: > On 16.9.2010 15:32, Alex wrote: >> I run an web application which uses spring, hibernate, apache-cxf and >> the quartz scheduler which is referenced by spring. >> >> The webapp work as it should, but on shutdown or restart the apache >> tomcat server I always get following output. >> >> The webapp is not stopped and I have to kill the process manually. >> >> How can I solve this? > > Are you using connection pooling provided by tomcat? Did you put MySQL driver >to $TOMCAT/lib or $TOMCAT/webapps/xxx/lib? Or both? If you are using connection >pooling keep your driver just in $TOMCAT/lib folder. > > If threads schedulerFactoryBeanERV_Worker-x, are created by Quartz, find how >can you stop them, and to that with ContextListener you will register in >web.xml. > > Also, read http://wiki.apache.org/tomcat/OutOfMemory. > > Regards, > Ognjen > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Mark, On 9/16/2010 1:09 PM, Mark Eggers wrote: > As another person said, make sure you have a recently updated MySQL driver. I > believe > anything >= 5.1.11 solves a threading issue that was reported on their (MySQL's) > bug > tracking database. NB: I believe the issue you are referencing is the creation of a statement cancellation timer thread that is unstoppable (as far as I have been able to get). The issue caught by Tomcat "leak-prevention" code was that the JDBC driver was registered but not unregistered. I believe you can use the non-registering version of the driver if the connection pool knows that you are definitely going to use a specific driver for creating the JDBC connections. I haven't done this myself, though. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkySZEEACgkQ9CaO5/Lv0PAYIwCgpyZzZjTakgGd/N+8WGQyLkG2 i4cAn2bf1Tu2pdE8ul3hh2czV1MCNvxc =qFiL -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
| Powered by Nabble | Edit this page |
