You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Trevor Stevens <ts...@me.com> on 2013/07/03 17:34:30 UTC

Automatically created datasources leaking classloader

When OpenEJB loads a persistence.xml if a non-jta-data-source element is not present it automatically generates a datasource to place there. The issue that I am seeing is that the datasource is never closed when the webapp containing that persistence.xml is undeployed. As a result the webapp's classloader is leaked since the datasource that was auto-created has a reference to the webapp's classloader. Would it be possible to have OpenEJB either close auto-created datasources when the webapp is unloaded or create those datasource using another classloader?

Screenshot of the leaked classloader http://d.pr/i/xtRq

INFO: Configuring PersistenceUnit(name=test, provider=org.hibernate.ejb.HibernatePersistence)
Jul 3, 2013 11:18:43 AM org.apache.openejb.config.AutoConfig logAutoCreateResource
INFO: Auto-creating a Resource with id 'test/resources/jdbc/testNonJta' of type 'DataSource for 'test'.
Jul 3, 2013 11:18:43 AM org.apache.openejb.config.AutoConfig deploy
INFO: Configuring Service(id=test/resources/jdbc/testNonJta, type=Resource, provider-id=test/resources/jdbc/test)
Jul 3, 2013 11:18:43 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=test/resources/jdbc/testNonJta)
Jul 3, 2013 11:18:43 AM org.apache.openejb.config.AutoConfig setJtaDataSource
INFO: Adjusting PersistenceUnit test <jta-data-source> to Resource ID 'test/resources/jdbc/test' from 'resources/jdbc/test'
Jul 3, 2013 11:18:43 AM org.apache.openejb.config.AutoConfig setNonJtaDataSource
INFO: Adjusting PersistenceUnit test <non-jta-data-source> to Resource ID 'test/resources/jdbc/testNonJta' from 'null'

Thanks,
Trevor Stevens
tstevens@me.com



Re: Automatically created datasources leaking classloader

Posted by Romain Manni-Bucau <rm...@gmail.com>.
https://issues.apache.org/jira/browse/TOMEE-988 should solve it

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/7/3 Trevor Stevens <ts...@me.com>

> When OpenEJB loads a persistence.xml if a non-jta-data-source element is
> not present it automatically generates a datasource to place there. The
> issue that I am seeing is that the datasource is never closed when the
> webapp containing that persistence.xml is undeployed. As a result the
> webapp's classloader is leaked since the datasource that was auto-created
> has a reference to the webapp's classloader. Would it be possible to have
> OpenEJB either close auto-created datasources when the webapp is unloaded
> or create those datasource using another classloader?
>
> Screenshot of the leaked classloader http://d.pr/i/xtRq
>
> INFO: Configuring PersistenceUnit(name=test,
> provider=org.hibernate.ejb.HibernatePersistence)
> Jul 3, 2013 11:18:43 AM org.apache.openejb.config.AutoConfig
> logAutoCreateResource
> INFO: Auto-creating a Resource with id 'test/resources/jdbc/testNonJta' of
> type 'DataSource for 'test'.
> Jul 3, 2013 11:18:43 AM org.apache.openejb.config.AutoConfig deploy
> INFO: Configuring Service(id=test/resources/jdbc/testNonJta,
> type=Resource, provider-id=test/resources/jdbc/test)
> Jul 3, 2013 11:18:43 AM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating Resource(id=test/resources/jdbc/testNonJta)
> Jul 3, 2013 11:18:43 AM org.apache.openejb.config.AutoConfig
> setJtaDataSource
> INFO: Adjusting PersistenceUnit test <jta-data-source> to Resource ID
> 'test/resources/jdbc/test' from 'resources/jdbc/test'
> Jul 3, 2013 11:18:43 AM org.apache.openejb.config.AutoConfig
> setNonJtaDataSource
> INFO: Adjusting PersistenceUnit test <non-jta-data-source> to Resource ID
> 'test/resources/jdbc/testNonJta' from 'null'
>
> Thanks,
> Trevor Stevens
> tstevens@me.com
>
>
>