-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

David,

On 2/12/15 2:01 PM, David kerber wrote:
> On 2/12/2015 1:46 PM, Wirth, Kevin wrote:
>> 
>> 
>> -----Original Message----- From: David kerber
>> [mailto:[email protected]] Sent: Thursday, February 12, 2015
>> 1:00 PM To: Tomcat Users List Subject: Re: tomcat severe error
>> when shutting down service but startup is clean
>> 
>> On 2/12/2015 12:48 PM, Cris Berneburg - US wrote:
>>> 
>>> -----Original Message----- From: David kerber
>>> [mailto:[email protected]] Sent: Thursday, February 12, 2015
>>> 9:40 AM To: Tomcat Users List Subject: Re: tomcat severe error
>>> when shutting down service but startup is clean
>>> 
>>> On 2/12/2015 9:06 AM, Wirth, Kevin wrote:
>>>> I keep getting these weird tomcat errors on shutdown on a
>>>> newly built system using tomcat 7.0.57 on  a windows 2012
>>>> server with jdk 1.7 that I can't figure out.  This is the
>>>> catalina log: Feb 12, 2015 8:54:31 AM
>>>> org.apache.catalina.loader.WebappClassLoader 
>>>> clearReferencesJdbc SEVERE: The web application [/identityiq]
>>>> registered the JDBC driver 
>>>> [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to 
>>>> unregister it when the web application was stopped. To
>>>> prevent a memory leak, the JDBC Driver has been forcibly
>>>> unregistered. Feb 12, 2015 8:54:31 AM
>>>> org.apache.catalina.loader.WebappClassLoader 
>>>> clearReferencesThreads SEVERE: The web application
>>>> [/identityiq] appears to have started a thread named
>>>> [Thread-3] but has failed to stop it. This is very likely to
>>>> create a memory leak.
>>> 
>>>>>> I ran into this a while back, and it means exactly what
>>>>>> it says: the db driver is being registered (loaded), but
>>>>>> not being unloaded.  I fixed it by putting the db driver
>>>>>> unload commands in a contextDestroyed method.
>>> 
>>> David
>>> 
>>> I have the same issue as Kevin.  What "unload commands" code
>>> did you call in the contextDestroyed method?  Are those methods
>>> "universal"? The reason I ask is because we use different ODBC
>>> drivers for different environments.
>> 
>> I call this code from my .contextDestroyed method (I didn't write
>> it, I copied it from somewhere on the web):
>> 
>> 
>> public static void unRegisterDrivers() { try { for (
>> Enumeration<Driver> drivers = DriverManager.getDrivers(); 
>> drivers.hasMoreElements(); ) { DriverManager.deregisterDriver(
>> drivers.nextElement() ); } } catch ( Exception e ) { /* log the
>> exception */ } }
>> 
>> Thank you for your response.  Where do I put this code as I am
>> new to tomcat?  The application I am deploying is not written by
>> me so I don't know the code.
> 
> It needs to be called from the .contextDestroyed method of
> whatever class is defined as a listener in your application.  I
> don't know if it can be done without modifying existing classes or
> not.

Yes, you can write a new ServletContextListener and register it along
with any others you may have. There is no need to modify existing code
(but you will have to add new code).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU3iVhAAoJEBzwKT+lPKRYOLMP/1gTWvu2ejJ28PJRC8wXo83s
5ScuJ915aIYq3Rbf+UjguXswkw2M9KGu7Uoi1svHYoqBY9iGbGIo/vand8ifkUUU
Vpm2IbIkgZM/Epemu9xSTJu/0pZNSFiYD0zHdItNsBbSm0zDtxR8aUQWp2IwdBnN
nawH7ePTNbtF3WwM8raDEyij3rL+tKwEYOsy3mwEdpPAVwMBANS4XOzjae6TgrCJ
VUMS30y4/aF9VMJZh+HuuCqafJ9ApVBj0Rpjgt4b11GSpeTwHtSWkf5L2IQ8i6DL
1uuS7WTz02aqUgM1E4lGRvRxJcmb9G+EPMLLW+EFcBC8E4pE2YP6oA5+BolWVp1N
vH4GjUwnT2EqYCSxtpzpzZEDpUdh6mJ0JrKtT2VZ4GxSA1BH00rBIK0GPC4WMEvu
H6DE0K2f/iDvrcaAxqNrVzkVABQmoOdwesXLWH75tGTLoGVF7E+3UuKcYAnrizdn
4SihCHQOeMWfuHh1YlYEh2JoSpGx30djwG7xq72BJzUyr4+WpGEEGXtDIAqX3tBU
ZaurvkbF727Ps7KN2Zz0+VSp3o9D0taXjHOq9hpjBh2iJI8L8k/R8MdSl0fqJvsc
zTo5+z+cMUQ2dQguWpuM9NydoSaZTJS6CiIqmKBTGE5i9W1PaHoQKdaTO+w4KqEY
cfnw3Xk28pGQ1pQ4kqSk
=J7AW
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to