On 2003.04.22 06:53 Jonathan.O'[EMAIL PROTECTED] wrote:
> Hi,
> We are also seeing these excpetions. However, all our connection
> accessing 
> code goes to one place, so I know opening and closing are paired.

There could be a jboss bug, but so far everyone who has started out knowing
that opening and closing are paired has found the leak in their own code
upon further investigation.

> This talk about adding a second connection has got me thinking. What is 
> the correct way of getting a connection? We use the following code:
>             InitialContext ic = new InitialContext();
>             DataSource ds = (DataSource) ic.lookup(dbPoolName);
>             return ds.getConnection();
> 
> Does this give me the connection object used by the current transaction?

yes.  Just be sure not to provide any way to pass a connection handle
between threads without going through the ejb interceptor stack (such as by
storing the connection in a static variable or singleton instance).

You may want to cache the datasource if this code is executed frequently.

david jencks

> How can I get it?
> Ciao,
> Jonathan O'Connor
> Development Manager
> XCOM Dublin
> 
> 
> 
> 
> 
> "Sonnek, Ryan" <[EMAIL PROTECTED]>
> Sent by: [EMAIL PROTECTED]
> 21.04.2003 16:20
> Please respond to jboss-user
> 
>  
>         To:     "'[EMAIL PROTECTED]'"
> <[EMAIL PROTECTED]>
>         cc: 
>         Subject:        RE: [JBoss-user] 3.0.6 vs. 3.0.7 wrapped
> connections question
> 
> 
> Hi david (ward),
> I'll just throw in my 2 cents, since I just went through this myself.  I
> think your observations are correct.  If you open a second connection 
> within
> the same transaction BEFORE closing the first connection you will see
> this
> activity.  I was doing the exact same thing from inside both session and
> entity beans, and started receiving these messages.  After changing my
> queries to not use 'nested queries' (ie: close the first connection, then
> open another one within the transaction), I noticed that these messages 
> went
> away.
> 
> As a side note, I believe that this has ALWAYS been the way that jboss
> has
> handled pooled connections and it just wasn't being displayed.  I say
> this
> because for the past six monthes my application has had a LONG
> outstanding
> bug where oracle would run out of cursors due to connections not being
> closed correctly.  Funny thing was that ALL connections were closed
> correctly, it was just using the nested queries that screwed it all up.
> 
> Ryan
> 
> -----Original Message-----
> From: David Ward [mailto:[EMAIL PROTECTED] 
> Sent: Monday, April 21, 2003 9:58 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [JBoss-user] 3.0.6 vs. 3.0.7 wrapped connections question
> 
> Thanks for your quick response, David.  Here's a related question,
> though:
> 
> Sometimes in the log, we see this:
> 
> 2003-04-21 10:07:55,242 INFO 
> [LocalTxConnectionManager$LocalConnectionEventListener] throwable from
> unregister connection
> java.lang.IllegalStateException: Trying to return an unknown connection2!
> [EMAIL PROTECTED]
>                  at
> org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConne
> ction(CachedConnectionManager.java:274)
>                  at
> org.jboss.resource.connectionmanager.LocalTxConnectionManager$LocalConnectio
> nEventListener.connectionClosed(LocalTxConnectionManager.java:371)
>                  at
> org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(Bas
> eWrapperManagedConnection.java:280)
>                  at
> org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.ja
> va:97)
> 
> 
> It comes from a place in our code that gets executed from (not directly
> inside)
> a TX=Required SLSB.  It is in a place where unfortunately (due to API) we
> can't
> share the same Connection we're using everywhere else, so in that code we
> have
> to re-lookup the DataSource, use a Connection and close it.  However, I
> think
> what's going on is that maybe the ConnectionManager is having trouble
> keeping
> track of more than one Connection being used within a single local TX?
> And
> maybe since closing (returning to DataSource) that second Connection
> confuses it
> as it wasn't the first Connection taken from the DataSource?  Later,
> we're
> seeing another stack trace saying "close it yourself."  But I'm thinking
> because
> of this past problem, it lost track of the original Connection that I'm 
> then
> trying to close?
> 
> I probably didn't say that too well so if it doesn't make sense I can try
> 
> it
> again... ;)
> 
> Thanks,
> David
> 
> 
> 
> Mensaje citado por David Jencks <[EMAIL PROTECTED]>:
> 
> > On 2003.04.21 08:42 David Ward wrote:
> > > In JBoss 3.0.7, we've seen some INFO stack traces saying that JBoss
> is
> > > closing a
> > > connection for us, "please do it yourself."  We've found some places
> > > where we
> > > forgot to close and have closed them, and others we are still
> tracking
> > > down.
> > > 
> > > However, in 3.0.6, we never saw the INFO stack traces.  Does this
> mean
> > > that
> > > JBoss was not closing stuff for us,
> > 
> > yes.  The "closing connection for you" is new with 3.0.7 (also present 
> in
> > current 3.2 and 4).
> > 
> >  or it was but was just being quiet
> > > about it?
> > 
> > no such luck.
> > 
> > david jencks
> > >  We would like to know so we can determine if we should hold up a
> release
> > > of our
> > > software that was going to be put onto 3.0.6.
> > > 
> > > Thanks,
> > > David
> > > 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to