You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael <sg...@gmx.net> on 2012/03/03 13:33:27 UTC

[Tomcat JDBC Pool] Close pooled connections via JMX

Hi folks,

I've been examining the JMX operations of the new pool and did not find 
a crucial one.

Sometimes our Oracle database has to be restarted, the pool still keeps 
the pooled connections. The webapp requests a connection, receives a 
pooled one and boom => ORA-... Connection closed.

I'd like to be able via JMX to reopen all open pooled connections 
without the need to restart the webapp.

Thanks,

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brooke,

On 3/4/12 4:57 PM, Brooke Hedrick wrote:
> Everyone - the feedback is great, but it still is just working
> around the elimination of a jmx call, if that is the case.
> 
> Why is the jmc close() method being eliminated?

Maybe I missed something... why do you think that the close() method
is being eliminated? As of 7.0.25, it's still in there.

Note that calling close() will kill the DataSource, not reset it.
You'll still have to figure out how to create a new one in its place
and register it. It sounds like what you really want to do is request
a new "recycle" method available through JMX that just closes and
re-opens all connections in the pool.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9U+GsACgkQ9CaO5/Lv0PAAJwCfbsk8rZUXLOBJQ8+v1TwcpQ+M
f80An3QsKn9rtBBPlVf5FPe+6PUvPlZa
=jOzd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Bob Hall <rf...@yahoo.com>.
From:Brooke Hedrick <br...@gmail.com>
Sent: Sunday, March 4, 2012 1:57 PM


>>
>> Have you tried defining views in the primary database based on the @otherdb queries?
>>
>>
> Bob,
> How will that help with the borrow query and not wanting to run extra queries to the remote db when not necessary?

It should eliminate the need to run extra queries, the queries would only be run when necessary against the views defined in the primary database.
Hopefully, Oracle will manage restarts of the remote DB.

> Everyone - the feedback is great, but it still is just working around the elimination of a jmx call, if that is the case.
> Why is the jmc close() method being eliminated?


Using views might result in the restoration of the close() method.

- Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Brooke Hedrick <br...@gmail.com>.
On Mar 4, 2012 2:50 PM, "Bob Hall" <rf...@yahoo.com> wrote:
>
>
>
>
>
> ________________________________
> From: Brooke Hedrick <br...@gmail.com>
> To: Tomcat Users List <us...@tomcat.apache.org>
> Sent: Sunday, March 4, 2012 12:21 PM
>
> > On Mar 4, 2012, at 1:35 PM, Chema <de...@gmail.com> wrote:
> >
> >>> We use Spring w/ Hibernate as I recall.  Yes, we have talked about
that - a
> >>> ping query.  What we don't like about that is now we have a tc ping
and app
> >>> ping.  We have also discussed just changing the tc borrow/ping to do
the
> >>> dual@remotedb query as this would test both primary and remote.  We
have
> >>> tested this and it works.  What stinks about this is we only access
the
> >>> remotedb 10% of the time.
> >>
> >> Well, I don't know how works Hibernate , but I know that you can have
> >> many SessionFactory
> >> Can you define different SessionFactory with different settings , for
> >> example, with different pingQuery value?
> >> Does Hibernate have a pingQuery setting ?
> >>
> >
> > Even if it does, are we actually losing the close() method for the
connection pool mbean?  If so, why?
> >
> > This change would mean requiring many development teams to change many
apps.  I don't see the value of requiring that change - if it is actually
the case we are losing the close() method.
>
>
> Have you tried defining views in the primary database based on the
@otherdb queries?
>
> - Bob
>

Bob,
How will that help with the borrow query and not wanting to run extra
queries to the remote db when not necessary?

Everyone - the feedback is great, but it still is just working around the
elimination of a jmx call, if that is the case.

Why is the jmc close() method being eliminated?

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Bob Hall <rf...@yahoo.com>.



________________________________
From: Brooke Hedrick <br...@gmail.com>
To: Tomcat Users List <us...@tomcat.apache.org> 
Sent: Sunday, March 4, 2012 12:21 PM

> On Mar 4, 2012, at 1:35 PM, Chema <de...@gmail.com> wrote:
> 
>>> We use Spring w/ Hibernate as I recall.  Yes, we have talked about that - a
>>> ping query.  What we don't like about that is now we have a tc ping and app
>>> ping.  We have also discussed just changing the tc borrow/ping to do the
>>> dual@remotedb query as this would test both primary and remote.  We have
>>> tested this and it works.  What stinks about this is we only access the
>>> remotedb 10% of the time.
>> 
>> Well, I don't know how works Hibernate , but I know that you can have
>> many SessionFactory
>> Can you define different SessionFactory with different settings , for
>> example, with different pingQuery value?
>> Does Hibernate have a pingQuery setting ?
>>
> 
> Even if it does, are we actually losing the close() method for the connection pool mbean?  If so, why?
> 
> This change would mean requiring many development teams to change many apps.  I don't see the value of requiring that change - if it is actually the case we are losing the close() method.


Have you tried defining views in the primary database based on the @otherdb queries?

- Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Brooke Hedrick <br...@gmail.com>.

On Mar 4, 2012, at 1:35 PM, Chema <de...@gmail.com> wrote:

>> We use Spring w/ Hibernate as I recall.  Yes, we have talked about that - a
>> ping query.  What we don't like about that is now we have a tc ping and app
>> ping.  We have also discussed just changing the tc borrow/ping to do the
>> dual@remotedb query as this would test both primary and remote.  We have
>> tested this and it works.  What stinks about this is we only access the
>> remotedb 10% of the time.
> 
> Well, I don't know how works Hibernate , but I know that you can have
> many SessionFactory
> Can you define different SessionFactory with different settings , for
> example, with different pingQuery value?
> Does Hibernate have a pingQuery setting ?
> 

Even if it does, are we actually losing the close() method for the connection pool mbean?  If so, why?

This change would mean requiring many development teams to change many apps.  I don't see the value of requiring that change - if it is actually the case we are losing the close() method.

> So, when you want to perform a remote query, you use SessionFactory
> who returns local connections but before  SELECT 1 FROM DUAL@remotedb
> testing query
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Chema <de...@gmail.com>.
> We use Spring w/ Hibernate as I recall.  Yes, we have talked about that - a
> ping query.  What we don't like about that is now we have a tc ping and app
> ping.  We have also discussed just changing the tc borrow/ping to do the
> dual@remotedb query as this would test both primary and remote.  We have
> tested this and it works.  What stinks about this is we only access the
> remotedb 10% of the time.

Well, I don't know how works Hibernate , but I know that you can have
many SessionFactory
Can you define different SessionFactory with different settings , for
example, with different pingQuery value?
Does Hibernate have a pingQuery setting ?

So, when you want to perform a remote query, you use SessionFactory
who returns local connections but before  SELECT 1 FROM DUAL@remotedb
testing query

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brooke,

On 3/4/12 10:29 AM, Brooke Hedrick wrote:
> There are cases where either or both get restarted, but the issue
> is only when the @otherdb is restarted and not the primary.

So, you have a setup like this:

DBCP --- jdbc ---> Primary --- Oracle --> Secondary

The secondary db is restarted and thus the "Oracle" link essentially
goes down. The next time you make a query across the "jdbc" link to
the secondary database, you get an error.

IMO you can't fix this at the Tomcat end without using a validation
query that tests the end-to-end connection. It really seems like the
wrong place to fix it, anyway. What you really need to fix is the
"Oracle" link, which is surely configured somewhere in Oracle.

Suppose if you could kill the whole pool, you'll get new connections,
but won't the "Oracle" link still be dead? Or, does a db-link co-exist
with the connection to the primary db?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9U40MACgkQ9CaO5/Lv0PDWlQCgr98eLBsOmFezC8o0OogeeKa2
T14An29FLIVaFbRFaTqfEAdeZt5LWlod
=U8gU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Brooke Hedrick <br...@gmail.com>.
On Mar 4, 2012 5:13 AM, "Chema" <de...@gmail.com> wrote:
>
> >>
> >> > That approach doesn't work when the application uses symlinks to get
to
> >> > data on other Oracle servers.
>
>
> Right. With dblinks, it's the RDBMS who opens/closes a session against
> the remote server, via dblinks
> I guess that when you say  "our Oracle database has to be restarted",
> you *only* restart the remote server , right ?

There are cases where either or both get restarted, but the issue is only
when the @otherdb is restarted and not the primary.

>
> One question :
>
> do you use any kind of ORM framework ? Some of them (myBatis , for
> example ) allow you to configure different schemas with different
> pingQuery settings.
> So, you could define the remote queries into a particular schema with
> a pingQuery like "SELECT 1 FROM DUAL@REMOTEDB"

We use Spring w/ Hibernate as I recall.  Yes, we have talked about that - a
ping query.  What we don't like about that is now we have a tc ping and app
ping.  We have also discussed just changing the tc borrow/ping to do the
dual@remotedb query as this would test both primary and remote.  We have
tested this and it works.  What stinks about this is we only access the
remotedb 10% of the time.  This means 90% of the time we are making queries
over to the remoted db unnecessarily.

Our solution is a small jmx client we wrote that goes across our 24
machines with about 5 jvms/ machine and 5 datasources/jvm.  It takes a few
seconds to close() those 600 datasources.

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Chema <de...@gmail.com>.
>>
>> > That approach doesn't work when the application uses symlinks to get to
>> > data on other Oracle servers.


Right. With dblinks, it's the RDBMS who opens/closes a session against
the remote server, via dblinks
I guess that when you say  "our Oracle database has to be restarted",
you *only* restart the remote server , right ?

One question :

do you use any kind of ORM framework ? Some of them (myBatis , for
example ) allow you to configure different schemas with different
pingQuery settings.
So, you could define the remote queries into a particular schema with
a pingQuery like "SELECT 1 FROM DUAL@REMOTEDB"

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Felix Schumacher <fe...@internetallee.de>.
Am Samstag, den 03.03.2012, 11:50 -0600 schrieb Brooke Hedrick:
> On Mar 3, 2012 11:48 AM, "Brooke Hedrick" <br...@gmail.com>
> wrote:
> >
> >
> > On Mar 3, 2012 11:35 AM, "Caldarale, Charles R" <
> Chuck.Caldarale@unisys.com> wrote:
> > >
> > > > From: Brooke Hedrick [mailto:brooke.t.hedrick@gmail.com]
> > > > Subject: Re: [Tomcat JDBC Pool] Close pooled connections via JMX
> > >
> > > > > Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
> > > > > DUAL" configured?
> > > > >
> > > > > This should suffice to ensure each connection is valid before use.
> > >
> > > > That approach doesn't work when the application uses symlinks to get
> to
> > > > data on other Oracle servers.
> > >
> > > That makes no sense to me; please explain how links in the file system
> affect DB connections over the network.
> > >
> >
> > Chuck, I used the wrong word.  I should have said 'database links'.  You
> will see things like: select * emp@otherdb.  Where @otherdb is typically an
> entry that you would find in a tnsnames.ora.
Have you tried to construct a validationQuery, which checks for such
database links? You could create simple tables in each of your
referenced databases and do a select on them. Possibly using a join, if
there are more than one databases referenced.

If you are using tomcat-jdbc pool, you can do a testWhileIdle instead of
testOnBorrow and have it check the connection(s) in the background at an
interval, that you can specify. So that it is not to bad, if your
validationQuery is a bit more expensive.

Regards
 Felix
> 
> Before you correct me, yes, I left out the FROM between the * and emp.
> >
> > >  - 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: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Brooke Hedrick [mailto:brooke.t.hedrick@gmail.com] 
> Subject: RE: [Tomcat JDBC Pool] Close pooled connections via JMX

> You will see things like: select * emp@otherdb.  Where @otherdb
> is typically an entry that you would find in a tnsnames.ora.

> I left out the FROM between the * and emp.

So it's the secondary connections that get broken and need to be reestablished, rather than the primary ones from Tomcat to the server named in the JDBC descriptor?  (Just trying to understand.)

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
On 3/3/2012 10:50 AM, Brooke Hedrick wrote:
> On Mar 3, 2012 11:48 AM, "Brooke Hedrick"<br...@gmail.com>
> wrote:
>>
>> On Mar 3, 2012 11:35 AM, "Caldarale, Charles R"<
> Chuck.Caldarale@unisys.com>  wrote:
>>>> From: Brooke Hedrick [mailto:brooke.t.hedrick@gmail.com]
>>>> Subject: Re: [Tomcat JDBC Pool] Close pooled connections via JMX
>>>>> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
>>>>> DUAL" configured?
>>>>>
>>>>> This should suffice to ensure each connection is valid before use.
>>>> That approach doesn't work when the application uses symlinks to get
> to
>>>> data on other Oracle servers.
>>> That makes no sense to me; please explain how links in the file system
> affect DB connections over the network.
>> Chuck, I used the wrong word.  I should have said 'database links'.  You
> will see things like: select * emp@otherdb.  Where @otherdb is typically an
> entry that you would find in a tnsnames.ora.
>
> Before you correct me, yes, I left out the FROM between the * and emp.

still doesn't make sense. if you need another DB validated, use another validation query.
sounds like one is creating a problem here rather than detecting one

>>>   - 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: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Brooke Hedrick <br...@gmail.com>.
On Mar 3, 2012 11:48 AM, "Brooke Hedrick" <br...@gmail.com>
wrote:
>
>
> On Mar 3, 2012 11:35 AM, "Caldarale, Charles R" <
Chuck.Caldarale@unisys.com> wrote:
> >
> > > From: Brooke Hedrick [mailto:brooke.t.hedrick@gmail.com]
> > > Subject: Re: [Tomcat JDBC Pool] Close pooled connections via JMX
> >
> > > > Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
> > > > DUAL" configured?
> > > >
> > > > This should suffice to ensure each connection is valid before use.
> >
> > > That approach doesn't work when the application uses symlinks to get
to
> > > data on other Oracle servers.
> >
> > That makes no sense to me; please explain how links in the file system
affect DB connections over the network.
> >
>
> Chuck, I used the wrong word.  I should have said 'database links'.  You
will see things like: select * emp@otherdb.  Where @otherdb is typically an
entry that you would find in a tnsnames.ora.

Before you correct me, yes, I left out the FROM between the * and emp.
>
> >  - 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: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >

RE: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Brooke Hedrick <br...@gmail.com>.
On Mar 3, 2012 11:35 AM, "Caldarale, Charles R" <Ch...@unisys.com>
wrote:
>
> > From: Brooke Hedrick [mailto:brooke.t.hedrick@gmail.com]
> > Subject: Re: [Tomcat JDBC Pool] Close pooled connections via JMX
>
> > > Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
> > > DUAL" configured?
> > >
> > > This should suffice to ensure each connection is valid before use.
>
> > That approach doesn't work when the application uses symlinks to get to
> > data on other Oracle servers.
>
> That makes no sense to me; please explain how links in the file system
affect DB connections over the network.
>

Chuck, I used the wrong word.  I should have said 'database links'.  You
will see things like: select * emp@otherdb.  Where @otherdb is typically an
entry that you would find in a tnsnames.ora.

>  - 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

RE: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Brooke Hedrick [mailto:brooke.t.hedrick@gmail.com] 
> Subject: Re: [Tomcat JDBC Pool] Close pooled connections via JMX

> > Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
> > DUAL" configured?
> >
> > This should suffice to ensure each connection is valid before use.

> That approach doesn't work when the application uses symlinks to get to
> data on other Oracle servers.

That makes no sense to me; please explain how links in the file system affect DB connections over the network.

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Brooke Hedrick <br...@gmail.com>.
On Mar 3, 2012 7:17 AM, "Pid" <pi...@pidster.com> wrote:
>
> On 03/03/2012 12:33, Michael wrote:
> > Hi folks,
> >
> > I've been examining the JMX operations of the new pool and did not find
> > a crucial one.
> >
> > Sometimes our Oracle database has to be restarted, the pool still keeps
> > the pooled connections. The webapp requests a connection, receives a
> > pooled one and boom => ORA-... Connection closed.
> >
> > I'd like to be able via JMX to reopen all open pooled connections
> > without the need to restart the webapp.
>
> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
> DUAL" configured?
>
> This should suffice to ensure each connection is valid before use.

That approach doesn't work when the application uses symlinks to get to
data on other Oracle servers.

>
>
> p
>
>
> --
>
> [key:62590808]
>

Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Michael <sg...@gmx.net>.
Pid schrieb:
> On 03/03/2012 12:33, Michael wrote:
>> Hi folks,
>>
>> I've been examining the JMX operations of the new pool and did not find
>> a crucial one.
>>
>> Sometimes our Oracle database has to be restarted, the pool still keeps
>> the pooled connections. The webapp requests a connection, receives a
>> pooled one and boom => ORA-... Connection closed.
>>
>> I'd like to be able via JMX to reopen all open pooled connections
>> without the need to restart the webapp.
> 
> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
> DUAL" configured?
> 
> This should suffice to ensure each connection is valid before use.

Hi Pid,

I did not yet try that option. Of course, if this works, I'll happy with 
  the "lazy" approach. I will test this the next couple of days and give 
feedback.

Thanks,

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Proxypass Question

Posted by Pid <pi...@pidster.com>.
Please start an entirely new thread, rather than replying to and editing
an existing, already rather long and confusing thread[1].


p


1. Re: [Tomcat JDBC Pool] Close pooled connections via JMX


RE: Proxypass Question

Posted by Martin Gainty <mg...@hotmail.com>.
Perfectly Normal

if a http request comes in yoiu want to 
1)log the request ( writing the HTTP Env Vars)
2)forward to https

if a https request comes in you want to 
1)log (writing the HTTP Env vars)
2)authenticate

does your client that uses Tomcat have at least *read access* to 
/mnt/html/example/www.example.com.key

Viel Gluck!
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


> From: truckman@woodbridgedata.com
> To: users@tomcat.apache.org
> Subject: Proxypass Question
> Date: Mon, 5 Mar 2012 23:18:52 -0500
> 
> Greetings,
> 
> I'm not sure whether this is a tomcat6 issue or an apache issue, but I thought maybe I would start here if no one minds.
> 
> We have a domain name and we have apache answering the door on both https(443) and http(80).  What we'd like to do is proxypass port 443 to tomcat6, and have port 80 serve html files normally on that domain name (i.e. different content)
> 
> So, we defined such in /etc/httpd/conf.d/virtuals.conf like so:
> 
> NameVirtualHost *:443
> 
> <VirtualHost *:443>
>         ServerName www.example.com:443
>         SSLEngine on
>         SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
>         SSLCertificateFile /mnt/html/example/example.com.crt
>         SSLCertificateKeyFile /mnt/html/example/www.example.com.key
>         ProxyPass / ajp://localhost:8009/
> </VirtualHost>
> 
> NameVirtualHost *:80
> 
> <VirtualHost *:80>
>         ServerName www.example.com:80
> #        ProxyPass / ajp://localhost:8009/
>         DocumentRoot    /mnt/html/example
> </VirtualHost>
> 
> With the above, nothing works and in the /var/log/error_log file we see an entry for "file does not exist /mnt/html/example/", and we get that entry regardless whether we hit ports 443 or port 80 - which tells us nothing is proxying when set this way.
> 
> If we change the latter part of the configuration file to this:
> 
> NameVirtualHost *:80
> 
> <VirtualHost *:80>
>         ServerName www.example.com:80
>         ProxyPass / ajp://localhost:8009/
> #        DocumentRoot    /mnt/html/example
> </VirtualHost>
> 
> Then https: does in fact proxy up to tomcat6, the application loads, and all is well.  However, it does the very same thing for port 80 as the proxypass statement is there also.
> 
> Proxypass seems to only work if both ports are proxied, and not work if either port is not proxied.
> 
> My question is this - is that the normal/expected behavior of proxypass, or should we keep digging elsewhere?
> 
> Thank you very much!
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

Proxypass Question

Posted by Truckman <tr...@woodbridgedata.com>.
Greetings,

I'm not sure whether this is a tomcat6 issue or an apache issue, but I thought maybe I would start here if no one minds.

We have a domain name and we have apache answering the door on both https(443) and http(80).  What we'd like to do is proxypass port 443 to tomcat6, and have port 80 serve html files normally on that domain name (i.e. different content)

So, we defined such in /etc/httpd/conf.d/virtuals.conf like so:

NameVirtualHost *:443

<VirtualHost *:443>
        ServerName www.example.com:443
        SSLEngine on
        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCertificateFile /mnt/html/example/example.com.crt
        SSLCertificateKeyFile /mnt/html/example/www.example.com.key
        ProxyPass / ajp://localhost:8009/
</VirtualHost>

NameVirtualHost *:80

<VirtualHost *:80>
        ServerName www.example.com:80
#        ProxyPass / ajp://localhost:8009/
        DocumentRoot    /mnt/html/example
</VirtualHost>

With the above, nothing works and in the /var/log/error_log file we see an entry for "file does not exist /mnt/html/example/", and we get that entry regardless whether we hit ports 443 or port 80 - which tells us nothing is proxying when set this way.

If we change the latter part of the configuration file to this:

NameVirtualHost *:80

<VirtualHost *:80>
        ServerName www.example.com:80
        ProxyPass / ajp://localhost:8009/
#        DocumentRoot    /mnt/html/example
</VirtualHost>

Then https: does in fact proxy up to tomcat6, the application loads, and all is well.  However, it does the very same thing for port 80 as the proxypass statement is there also.

Proxypass seems to only work if both ports are proxied, and not work if either port is not proxied.

My question is this - is that the normal/expected behavior of proxypass, or should we keep digging elsewhere?

Thank you very much!




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Chema <de...@gmail.com>.
> There's nothing like chasing your tail for a few days on a mailing list.
>
> - -chris

ok, ok ...it was my fault ... sorry :-/

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pid,

On 3/5/12 5:55 PM, Pid wrote:
> On 05/03/2012 22:12, Christopher Schultz wrote:
>> Chema,
>> 
>> On 3/5/12 4:06 PM, Chema wrote:
>>>> No if the connection has been reset by the instance. The
>>>> query will result in a SQLException. You have to close the
>>>> connection and open a new one. The query works on an open
>>>> connection only. That's the point. See the second paragraph
>>>> of this [1].
>>>> 
>> 
>>> But the problem was when you restart the remote database , not
>>> the local database. In this case, SELECT 1 FROM DUAL works (
>>> doesn't return a SQL exception ). But , when you execute after
>>> the query "SELEC * FROM TABLE@remotedb", then fails , was this
>>> the problem, right ?
>> 
>> Correct.
>> 
>> Note that Michael was having a problem that was solved by using
>> a validationQuery.  Brooke is the one with an elaborate two-tier 
>> database with these links that survive SELECT 1 FROM DUAL but
>> not SELECT 1 FROM TABLE@remotedb.
> 
> To be fair, between that & the discussion about 'losing the close 
> method' it's no wonder people got confused...

There's nothing like chasing your tail for a few days on a mailing list.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9VXMoACgkQ9CaO5/Lv0PBUWgCgrCozrsjfedR5NkZ6sy4pqs02
OcUAoJLuKRPTWnkssK59SgUjsMFRESts
=BcMC
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Pid <pi...@pidster.com>.
On 05/03/2012 22:12, Christopher Schultz wrote:
> Chema,
> 
> On 3/5/12 4:06 PM, Chema wrote:
>>> No if the connection has been reset by the instance. The query
>>> will result in a SQLException. You have to close the connection
>>> and open a new one. The query works on an open connection only.
>>> That's the point. See the second paragraph of this [1].
>>>
> 
>> But the problem was when you restart the remote database , not the 
>> local database. In this case, SELECT 1 FROM DUAL works ( doesn't
>> return a SQL exception ). But , when you execute after the query
>> "SELEC * FROM TABLE@remotedb", then fails , was this the problem,
>> right ?
> 
> Correct.
> 
> Note that Michael was having a problem that was solved by using a
> validationQuery.  Brooke is the one with an elaborate two-tier
> database with these links that survive SELECT 1 FROM DUAL but not
> SELECT 1 FROM TABLE@remotedb.

To be fair, between that & the discussion about 'losing the close
method' it's no wonder people got confused...


p



-- 

[key:62590808]


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chema,

On 3/5/12 4:06 PM, Chema wrote:
>> No if the connection has been reset by the instance. The query
>> will result in a SQLException. You have to close the connection
>> and open a new one. The query works on an open connection only.
>> That's the point. See the second paragraph of this [1].
>> 
> 
> But the problem was when you restart the remote database , not the 
> local database. In this case, SELECT 1 FROM DUAL works ( doesn't
> return a SQL exception ). But , when you execute after the query
> "SELEC * FROM TABLE@remotedb", then fails , was this the problem,
> right ?

Correct.

Note that Michael was having a problem that was solved by using a
validationQuery.  Brooke is the one with an elaborate two-tier
database with these links that survive SELECT 1 FROM DUAL but not
SELECT 1 FROM TABLE@remotedb.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9VOmAACgkQ9CaO5/Lv0PCZCACdHN9yBw5h55WbUf5CtgG9hMId
0qcAn2Cf5mDw0dZ/NA3ap+XNNFJiyKC8
=o9Fc
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Chema <de...@gmail.com>.
> No if the connection has been reset by the instance. The query will result
> in a SQLException. You have to close the connection and open a new one. The
> query works on an open connection only. That's the point.
> See the second paragraph of this [1].
>

But the problem was when you restart the remote database , not the
local database.
In this case, SELECT 1 FROM DUAL works ( doesn't return a SQL exception ).
But , when you execute after the query "SELEC * FROM TABLE@remotedb",
then fails , was this the problem, right ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Michael <sg...@gmx.net>.
Chema schrieb:
> 2012/3/5 Michael <sg...@gmx.net>:
>> Chema schrieb:
>>
>>>>> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
>>>>> DUAL" configured?
>>>>>
>>>>> This should suffice to ensure each connection is valid before use.
>>>>
>>>> Pid,
>>>>
>>>> works like a charms. Thanks very much.
>>>>
> 
>> It executes the validation query and checks if there is no SQLException.
> 
> Thanks ...but , if you only restart the remote db , the query "SELECT
> 1 FROM DUAL" always works , am I wrong ?

No if the connection has been reset by the instance. The query will 
result in a SQLException. You have to close the connection and open a 
new one. The query works on an open connection only. That's the point.
See the second paragraph of this [1].

Mike

[1] 
http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#isClosed%28%29

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Chema <de...@gmail.com>.
2012/3/5 Michael <sg...@gmx.net>:
> Chema schrieb:
>
>>>> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
>>>> DUAL" configured?
>>>>
>>>> This should suffice to ensure each connection is valid before use.
>>>
>>>
>>> Pid,
>>>
>>> works like a charms. Thanks very much.
>>>
>>

> It executes the validation query and checks if there is no SQLException.

Thanks ...but , if you only restart the remote db , the query "SELECT
1 FROM DUAL" always works , am I wrong ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Michael <sg...@gmx.net>.
Chema schrieb:
>>> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
>>> DUAL" configured?
>>>
>>> This should suffice to ensure each connection is valid before use.
>>
>> Pid,
>>
>> works like a charms. Thanks very much.
>>
> 
>>From Tomcat doc for testOnBorrow setting:
> 
> "The indication of whether objects will be validated before being
> borrowed from the pool. If the object fails to validate, it will be
> dropped from the pool, and we will attempt to borrow another
> For a true value to have any effect, the validationQuery parameter
> must be set to a non-null string. Default value is false In order to
> have a more efficient validation, see validationInterval Default value
> is false"
> 
> I don't understand how it works now
> 
> By the way, what does "validate" a object ?

It executes the validation query and checks if there is no SQLException.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Chema <de...@gmail.com>.
>>
>> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
>> DUAL" configured?
>>
>> This should suffice to ensure each connection is valid before use.
>
>
> Pid,
>
> works like a charms. Thanks very much.
>

>From Tomcat doc for testOnBorrow setting:

"The indication of whether objects will be validated before being
borrowed from the pool. If the object fails to validate, it will be
dropped from the pool, and we will attempt to borrow another
For a true value to have any effect, the validationQuery parameter
must be set to a non-null string. Default value is false In order to
have a more efficient validation, see validationInterval Default value
is false"

I don't understand how it works now

By the way, what does "validate" a object ?

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Michael <sg...@gmx.net>.
Pid schrieb:
> On 03/03/2012 12:33, Michael wrote:
>> Hi folks,
>>
>> I've been examining the JMX operations of the new pool and did not find
>> a crucial one.
>>
>> Sometimes our Oracle database has to be restarted, the pool still keeps
>> the pooled connections. The webapp requests a connection, receives a
>> pooled one and boom => ORA-... Connection closed.
>>
>> I'd like to be able via JMX to reopen all open pooled connections
>> without the need to restart the webapp.
> 
> Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
> DUAL" configured?
> 
> This should suffice to ensure each connection is valid before use.

Pid,

works like a charms. Thanks very much.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat JDBC Pool] Close pooled connections via JMX

Posted by Pid <pi...@pidster.com>.
On 03/03/2012 12:33, Michael wrote:
> Hi folks,
> 
> I've been examining the JMX operations of the new pool and did not find
> a crucial one.
> 
> Sometimes our Oracle database has to be restarted, the pool still keeps
> the pooled connections. The webapp requests a connection, receives a
> pooled one and boom => ORA-... Connection closed.
> 
> I'd like to be able via JMX to reopen all open pooled connections
> without the need to restart the webapp.

Do you have testOnBorrow="true" and a validationQuery="SELECT 1 FROM
DUAL" configured?

This should suffice to ensure each connection is valid before use.


p


-- 

[key:62590808]