db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clute, Andrew" <Andrew.Cl...@osn.state.oh.us>
Subject New Feature Proposal (WAS: ManagedConnections not being released)
Date Thu, 12 Feb 2004 21:33:58 GMT
 I can confirm that my theory down below was the cause of my problem. My
creating my own CollectionProxy that was aware of how to walk back
across the wire, inside a CM-tx, to my dataset worked fine.

Now, that left open the fact that for 1:1 Proxy's, IndirectionHandler
was the only implementation.

I have coded a change that will allow for IndirectionHandler to
configured, exactly like CollectionProxy. If no entry is defined, then
it defaults back to IndirectionHandler. The coding style is the exact
same as that for Collection proxy.

If this is perceived as being valuable, I would like to contribute the
code back. Who should I send the diff files to?

-Andrew



-----Original Message-----
From: Clute, Andrew [mailto:Andrew.Clute@osn.state.oh.us] 
Sent: Thursday, February 12, 2004 3:06 PM
To: OJB Developers List
Subject: RE: ManagedConnections not being released

Armin,

After further investigation, I can confirm it is related to the use of
Proxy's.

Now, I have theory, and I want to see if this could be possible:

With a normal method on an EJB and using CM-tx, when the EJB method is
finished, the EJB container calls commit and
PersistenceBrokerFactorSyncImpl is called, and that is the change that
OJB has to wrap up it's work, and physically close the database
connection.

However, when using a proxy (even when both client and EJB are in the
same VM), it's access to the data is through a new instance of a
PersistenceBroker. That is causing a new connection to be opened up, but
because it is not inside a method call to an EJB, there is no 'Commit'
phase that happens, and so PBFSync is never called and allowed to close
the database connection.

Do think this is accurate?

So, the solution to this is for me to create my own collection proxy
that can call an EJB to get the data from OJB -- that will mean that the
call for that will be inside an EJB transaction. I am assuming I also
going to have to write a custom IndirectionHandler to handle the 1:1
proxy's (but that doesn't seem to be pluggable in the OJB.properities
file)

Thoughts

-Andrew 

-----Original Message-----
From: Armin Waibel [mailto:arminw@apache.org]
Sent: Thursday, February 12, 2004 1:05 PM
To: OJB Developers List
Subject: Re: ManagedConnections not being released

Hi,

Clute, Andrew wrote:

> I have the latest from head. I am using Jboss 3.2.3, with CM-tx for my

> EJB's. I have my connection pool set to a maximum of 30 connections, 
> but it fills up real quick. I am closing the PersistenceBroker, and I 
> have debuged, and I do see the _conn.close() being called on the Jboss

> WrappedConnection, but I look and all 30 connections are used.
> 
> 

hmm, I assume you are using proxy? This is problematic in a 3-tier
environment, because how should the proxy be materialized on the client
side? (by the way, try to set useAutoCommit="0") But I don't know what's
the reason for your exhausted con-pool, maybe a side-effect of the proxy
use?

regards,
Armin

> Thoughts? I apologize in advance if this is a stupid configuration 
> issue.
> 
> -Andrew
> 
> Here is my OJB repository datasource description:
> 
> <jdbc-connection-descriptor
> 	jcd-alias="devsql"
> 	default-connection="true"
>    	platform="MsSQLServer"
>    	jdbc-level="3.0"
>    	jndi-datasource-name="java:MsSqlDevDS"
>    	useAutoCommit="2"
>    	>
>    	<object-cache
> class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
>             <attribute attribute-name="timeout"
attribute-value="900"/>
>             <attribute attribute-name="autoSync"
> attribute-value="true"/>
>        </object-cache>
>    		
>    	<sequence-manager
>  
> className="org.apache.ojb.broker.util.sequence.SequenceManagerMSSQLGui
> dI
> mpl" />
> 
> </jdbc-connection-descriptor>
> 
> Here is my jBoss Datasource descriptor:
> 
> <datasources>
>   <local-tx-datasource>
>     <jndi-name>MsSqlDevDS</jndi-name>
>  
> <connection-url>jdbc:inetdae7:192.168.2.30:1433?<removed></connection-
> ur
> l>
>     <driver-class>com.inet.tds.TdsDriver</driver-class>
>     <min-pool-size>5</min-pool-size>
>     <max-pool-size>30</max-pool-size>
>     <idle-timeout-minutes>1</idle-timeout-minutes>
>     <check-valid-connection-sql>select 1</check-valid-connection-sql>
>   </local-tx-datasource>
> </datasources>
> 
> And here is the error stack:
> 
> 12:29:49,906 ERROR [org.jboss.web.localhost.Engine]
> StandardWrapperValve[org.osn.webapp.jcore.doclib.docview_jsp]:
> Servlet.service() for servlet org.osn.webapp.jcore.doclib.docview_jsp
> threw exception
> org.apache.ojb.broker.PersistenceBrokerException:
> org.apache.ojb.broker.PersistenceBrokerException:
> org.apache.ojb.broker.PersistenceBrokerException: Used 
> ConnectionManager instance could not obtain a connection
> 	at
> org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionP
> ro
> xy.java:158)
> 	at
>
org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:187)
> 	at
> org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionPr
> ox
> y.java:401)
> 	at
> org.apache.ojb.broker.accesslayer.CollectionProxy.iterator(CollectionP
> ro
> xy.java:230)
> 	at
> org.osn.bom.Document.getCurrentDocumentVersion(Document.java:274)
> Caused by: org.apache.ojb.broker.PersistenceBrokerException:
> org.apache.ojb.broker.PersistenceBrokerException: Used 
> ConnectionManager instance could not obtain a connection
> 	at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Q
> ue
> ryReferenceBroker.java:250)
> 	at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(
> Pe
> rsistenceBrokerImpl.java:1012)
> 	at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionBy
> Qu
> ery(DelegatingPersistenceBroker.java:312)
> 	at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionBy
> Qu
> ery(DelegatingPersistenceBroker.java:312)
> 	at
> org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionP
> ro
> xy.java:148)
> 	... 51 more
> Caused by: org.apache.ojb.broker.PersistenceBrokerException: Used 
> ConnectionManager instance could not obtain a connection
> 	at
> org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatemen
> t(
> StatementManager.java:680)
> 	at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAcce
> ss
> Impl.java:315)
> 	at
> org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryOb
> je
> ct.java:113)
> 	at
>
org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:211)
> 	at
> org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIt
> er
> atorFactoryImpl.java:97)
> 	at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuer
> y(
> PersistenceBrokerImpl.java:1631)
> 	at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(
> Pe
> rsistenceBrokerImpl.java:1136)
> 	at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Q
> ue
> ryReferenceBroker.java:143)
> 	at
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Q
> ue
> ryReferenceBroker.java:242)
> 	... 55 more
> Caused by: org.apache.ojb.broker.accesslayer.LookupException:
> SQLException thrown while trying to get Connection from Datasource
> (java:MsSqlDevDS)
> 	at
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newCon
> ne
> ctionFromDataSource(ConnectionFactoryAbstractImpl.java:200)
> 	at
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookup
> Co
> nnection(ConnectionFactoryAbstractImpl.java:97)
> 	at
> org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl.lookupC
> on
> nection(ConnectionFactoryManagedImpl.java:18)
> 	at
> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(
> Co
> nnectionManagerImpl.java:144)
> 	at
> org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatemen
> t(
> StatementManager.java:676)
> 	... 63 more
> Caused by: org.jboss.util.NestedSQLException: No ManagedConnections 
> available within configured blocking timeout ( 5000 [ms] ); - nested
> throwable: (javax.resource.ResourceException: No ManagedConnections 
> available within configured blocking timeout ( 5000 [ms] ))
> 	at
> org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(Wrappe
> rD
> ataSource.java:106)
> 	at
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newCon
> ne
> ctionFromDataSource(ConnectionFactoryAbstractImpl.java:189)
> 	... 67 more
> Caused by: javax.resource.ResourceException: No ManagedConnections 
> available within configured blocking timeout ( 5000 [ms] )
> 	at
> org.jboss.resource.connectionmanager.InternalManagedConnectionPool.get
> Co
> nnection(InternalManagedConnectionPool.java:250)
> 	at
> org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePo
> ol
> .getConnection(JBossManagedConnectionPool.java:496)
> 	at
> org.jboss.resource.connectionmanager.BaseConnectionManager2.getManaged
> Co
> nnection(BaseConnectionManager2.java:425)
> 	at
> org.jboss.resource.connectionmanager.TxConnectionManager.getManagedCon
> ne
> ction(TxConnectionManager.java:318)
> 	at
> org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateCo
> nn
> ection(BaseConnectionManager2.java:477)
> 	at
> org.jboss.resource.connectionmanager.BaseConnectionManager2$Connection
> Ma
> nagerProxy.allocateConnection(BaseConnectionManager2.java:814)
> 	at
> org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(Wrappe
> rD
> ataSource.java:102)
> 	... 68 more
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For 
> additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional
commands, e-mail: ojb-dev-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional
commands, e-mail: ojb-dev-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message