tomcat-dbcp Poolable connection is closed while connection is in ALLOCATED state

2018-09-15 Thread Aman Verma
Hi,
In the java application (using tomcat 7, JDK 7u51,
tomcat-dbcp-8.0.3.jar, ojdbc6.jar) there is a certain connection leak.
After the connection pool was exhausted (pool reached maxTotal active
connections), I took heap dump. On analyzing heap dump, as expected
maxTotal PoolableConnection and associated maxTotal DefaulPooledObject
was found. All the connection were associated with "ALLOCATED"
PooledObjectState as I would expect.

However, All the PoolableConnection (that seemed to leak) had
"_closed"  boolean as true.

When I decompiled tomcat-dbcp jar, It seems that every time a
PoolableConnection is closed, the code sets associated
PooledObjectState to IDLE and returns the connection to pool.

My doubt is, why did my heap dump capture PoolableConnection as
"closed" while still associated to ALLOCATED PooledObjectState.

image evidence at :
https://stackoverflow.com/questions/52347117/tomcat-dbcp-closed-poolableconnection-but-in-allocated-state

Regards,
Aman

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



Re: DBCP params different for the Tomcat DBCP implementation in Tomcat 8?

2015-10-07 Thread Konstantin Kolinko
2015-10-07 21:36 GMT+03:00 Bradley Wagner <bradley.wag...@hannonhill.com>:
> Hi,
>
> We recently upgraded to Tomcat 8. As per the Migration Guide:
> https://tomcat.apache.org/migration-8.html#Database_Connection_Pooling and
> DBCP documentation
> https://tomcat.apache.org/tomcat-8.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations,
> we switched to using the new param values like: maxTotal and maxWaitMillis.
>
> Then, we switched to using the Tomcat DBCP by adding
> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory". Tomcat did not
> seem to have a problem with using Tomcat DBCP with the updated param names.

No, you did not. The above factory is for "Tomcat JDBC" pool implementation.

It was inspired by DBCP1, but is different from both Commons DBCP1
(used by default in Tomcat 6, 7) and Commons DBCP2 (used by default in
Tomcat 8).

> Then, I modified a test we were running to also use  a Spring initialized,
> Tomcat DBCP DataSource:
>
>  destroy-method="close">
>
> Now, our test is complaining with: "Bean property 'maxWaitMillis' is not
> writable or has an invalid setter method." because we were using the new
> style param name:
>
> 
>
> So now I'm confused.
>
> 1. Does Tomcat DBCP (in Tomcat 8) indeed use different params than the new
> DBCP2 that ships with Tomcat 8?
> 2. Why did Tomcat not complain when I was using maxWaitMillis with the
> updated factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" but does
> complain when I try to instantiate that pool implementation's DataSource
> directly?
> 3. Is there some other way that I should be instantiating the Tomcat DBCP
> DataSource in my test that would be more appropriate?
>
> I searched the archives and couldn't find mention of this.
>
> Thanks!
>
>
> --
> Bradley Wagner
> VP Engineering, Hannon Hill
> www.hannonhill.com | Twitter <https://twitter.com/hannon_hill> | Github
> <http://github.com/hannonhill>

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



Re: DBCP params different for the Tomcat DBCP implementation in Tomcat 8?

2015-10-07 Thread Bradley Wagner
Did not what?

We added "factory='org.apache.tomcat.jdbc.pool.DataSourceFactory'". That
switched us to Tomcat DBCP, correct?

At that time, we were using the updated "maxWaitMillis" and "maxTotal" in
our context.xml and Tomcat didn't seem to complain on startup.

Then, when we tried to set "maxWaitMillis" on a manually created Tomcat
DBCP dataSource:
 "" in a test at which point we got an error about
that class not having a 'maxWaitMillis' setter.

Was the Tomcat DBCP we were using in our context.xml just failing silently
or ignoring the 'maxWaitMillis' and 'maxTotal' params and we didn't realize
it? Are the params here:
https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html mean to be the
definitive ones for Tomcat DBCP?

On Wed, Oct 7, 2015 at 2:46 PM Konstantin Kolinko <knst.koli...@gmail.com>
wrote:

> 2015-10-07 21:36 GMT+03:00 Bradley Wagner <bradley.wag...@hannonhill.com>:
> > Hi,
> >
> > We recently upgraded to Tomcat 8. As per the Migration Guide:
> > https://tomcat.apache.org/migration-8.html#Database_Connection_Pooling
> and
> > DBCP documentation
> >
> https://tomcat.apache.org/tomcat-8.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations
> ,
> > we switched to using the new param values like: maxTotal and
> maxWaitMillis.
> >
> > Then, we switched to using the Tomcat DBCP by adding
> > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory". Tomcat did not
> > seem to have a problem with using Tomcat DBCP with the updated param
> names.
>
> No, you did not. The above factory is for "Tomcat JDBC" pool
> implementation.
>
> It was inspired by DBCP1, but is different from both Commons DBCP1
> (used by default in Tomcat 6, 7) and Commons DBCP2 (used by default in
> Tomcat 8).
>
> > Then, I modified a test we were running to also use  a Spring
> initialized,
> > Tomcat DBCP DataSource:
> >
> >  > destroy-method="close">
> >
> > Now, our test is complaining with: "Bean property 'maxWaitMillis' is not
> > writable or has an invalid setter method." because we were using the new
> > style param name:
> >
> > 
> >
> > So now I'm confused.
> >
> > 1. Does Tomcat DBCP (in Tomcat 8) indeed use different params than the
> new
> > DBCP2 that ships with Tomcat 8?
> > 2. Why did Tomcat not complain when I was using maxWaitMillis with the
> > updated factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" but does
> > complain when I try to instantiate that pool implementation's DataSource
> > directly?
> > 3. Is there some other way that I should be instantiating the Tomcat DBCP
> > DataSource in my test that would be more appropriate?
> >
> > I searched the archives and couldn't find mention of this.
> >
> > Thanks!
> >
> >
> > --
> > Bradley Wagner
> > VP Engineering, Hannon Hill
> > www.hannonhill.com | Twitter <https://twitter.com/hannon_hill> | Github
> > <http://github.com/hannonhill>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
> --
Bradley Wagner
VP Engineering, Hannon Hill
www.hannonhill.com | Twitter <https://twitter.com/hannon_hill> | Github
<http://github.com/hannonhill>


Re: DBCP params different for the Tomcat DBCP implementation in Tomcat 8?

2015-10-07 Thread Mark Thomas
On 07/10/2015 19:54, Bradley Wagner wrote:
> Did not what?
> 
> We added "factory='org.apache.tomcat.jdbc.pool.DataSourceFactory'". That
> switched us to Tomcat DBCP, correct?

No. There is no such thing as Tomcat DBCP.

There is Apache Commons DBCP 1. This is used by default in Tomcat 6.0.x
and 7.0.x.

There is Apache Commons DBCP 2. This is used in default Tomcat 8.0.x.

Commons DBCP is packaged renamed to avoid class loading conflicts if the
web application includes a copy of Commons DBCP in WEB-IN/lib.

There is also the Tomcat JDBC connection pool. This is entirely separate
from DBCP. For the full history, read this [1].

> At that time, we were using the updated "maxWaitMillis" and "maxTotal" in
> our context.xml and Tomcat didn't seem to complain on startup.
> 
> Then, when we tried to set "maxWaitMillis" on a manually created Tomcat
> DBCP dataSource:
>  " destroy-method="close">" in a test at which point we got an error about
> that class not having a 'maxWaitMillis' setter.
> 
> Was the Tomcat DBCP we were using in our context.xml just failing silently
> or ignoring the 'maxWaitMillis' and 'maxTotal' params and we didn't realize
> it?

I suspect Tomcat was changing the names as required under the covers
without telling you anything.

> Are the params here:
> https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html mean to be the
> definitive ones for Tomcat DBCP?

Those are for Tomcat JDBC. There is no Tomcat DBCP.

Mark


[1] http://markmail.org/message/nhayhdcstkj2lssf

> 
> On Wed, Oct 7, 2015 at 2:46 PM Konstantin Kolinko <knst.koli...@gmail.com>
> wrote:
> 
>> 2015-10-07 21:36 GMT+03:00 Bradley Wagner <bradley.wag...@hannonhill.com>:
>>> Hi,
>>>
>>> We recently upgraded to Tomcat 8. As per the Migration Guide:
>>> https://tomcat.apache.org/migration-8.html#Database_Connection_Pooling
>> and
>>> DBCP documentation
>>>
>> https://tomcat.apache.org/tomcat-8.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations
>> ,
>>> we switched to using the new param values like: maxTotal and
>> maxWaitMillis.
>>>
>>> Then, we switched to using the Tomcat DBCP by adding
>>> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory". Tomcat did not
>>> seem to have a problem with using Tomcat DBCP with the updated param
>> names.
>>
>> No, you did not. The above factory is for "Tomcat JDBC" pool
>> implementation.
>>
>> It was inspired by DBCP1, but is different from both Commons DBCP1
>> (used by default in Tomcat 6, 7) and Commons DBCP2 (used by default in
>> Tomcat 8).
>>
>>> Then, I modified a test we were running to also use  a Spring
>> initialized,
>>> Tomcat DBCP DataSource:
>>>
>>> >> destroy-method="close">
>>>
>>> Now, our test is complaining with: "Bean property 'maxWaitMillis' is not
>>> writable or has an invalid setter method." because we were using the new
>>> style param name:
>>>
>>> 
>>>
>>> So now I'm confused.
>>>
>>> 1. Does Tomcat DBCP (in Tomcat 8) indeed use different params than the
>> new
>>> DBCP2 that ships with Tomcat 8?
>>> 2. Why did Tomcat not complain when I was using maxWaitMillis with the
>>> updated factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" but does
>>> complain when I try to instantiate that pool implementation's DataSource
>>> directly?
>>> 3. Is there some other way that I should be instantiating the Tomcat DBCP
>>> DataSource in my test that would be more appropriate?
>>>
>>> I searched the archives and couldn't find mention of this.
>>>
>>> Thanks!
>>>
>>>
>>> --
>>> Bradley Wagner
>>> VP Engineering, Hannon Hill
>>> www.hannonhill.com | Twitter <https://twitter.com/hannon_hill> | Github
>>> <http://github.com/hannonhill>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>> --
> Bradley Wagner
> VP Engineering, Hannon Hill
> www.hannonhill.com | Twitter <https://twitter.com/hannon_hill> | Github
> <http://github.com/hannonhill>
> 


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



DBCP params different for the Tomcat DBCP implementation in Tomcat 8?

2015-10-07 Thread Bradley Wagner
Hi,

We recently upgraded to Tomcat 8. As per the Migration Guide:
https://tomcat.apache.org/migration-8.html#Database_Connection_Pooling and
DBCP documentation
https://tomcat.apache.org/tomcat-8.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations,
we switched to using the new param values like: maxTotal and maxWaitMillis.

Then, we switched to using the Tomcat DBCP by adding
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory". Tomcat did not
seem to have a problem with using Tomcat DBCP with the updated param names.

Then, I modified a test we were running to also use  a Spring initialized,
Tomcat DBCP DataSource:



Now, our test is complaining with: "Bean property 'maxWaitMillis' is not
writable or has an invalid setter method." because we were using the new
style param name:



So now I'm confused.

1. Does Tomcat DBCP (in Tomcat 8) indeed use different params than the new
DBCP2 that ships with Tomcat 8?
2. Why did Tomcat not complain when I was using maxWaitMillis with the
updated factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" but does
complain when I try to instantiate that pool implementation's DataSource
directly?
3. Is there some other way that I should be instantiating the Tomcat DBCP
DataSource in my test that would be more appropriate?

I searched the archives and couldn't find mention of this.

Thanks!


-- 
Bradley Wagner
VP Engineering, Hannon Hill
www.hannonhill.com | Twitter <https://twitter.com/hannon_hill> | Github
<http://github.com/hannonhill>


Re: Tomcat DBCP 8.0.18 issue

2015-06-03 Thread Tweak Ronaldo
Hmm, interesting... Thanks for explanation Mark!

2015-06-03 12:22 GMT+03:00 Mark Thomas ma...@apache.org:

 On 03/06/2015 07:24, Tweak Ronaldo wrote:
  Thanks Mark, yes I have mixed together Tomcat JDBC 8 and DBCP 7, my bad.
  Although I don't understand why Tomcat JDBC don't use DBCP as default
  solution for connections pooling.

 Tomcat does - and always has - used Commons DBCP for connection pooling
 by default.

 We do package rename Commons DBCP to avoid conflicts for web
 applications that package it in WEB-INF/lib and we have changed how we
 have done that repackaging over the years but the source code remains
 unchanged from which ever release version / tag / svn revision we select
 to pull in.


 What follows is a short(ish) history of Commons DBCP and tomcat-jdbc
 which attempts to explain why Tomcat ended up shipping two connection
 pools.

 Commons DBCP 1 has very poor performance in highly concurrent
 environments. Things improved during the 1.x series but really didn't
 improve much above 'awful'.

 As users started to run Tomcat on machines with increasing numbers of
 cores, the performance issues with DBCP 1 started to have a noticeable
 impact for some web applications. Something needed to be done to address
 the performance issues in concurrent environments.

 There were two options:
 a) fix DBCP (essentially this meant a major re-write for Commons Pool)
 b) implement a new connection pool

 My preference was for a) although I had little time to do any work along
 those lines. Keep in mind that my preference for a) is likely to have
 coloured my view of the history of this.

 Filip's preference was for b). He also felt that there was room to
 further improve performance by removing the overhead inherent in:
 i)  Commons DBCP being built on Commons Pool
 (a single module could be more tightly / efficiently integrated)
 ii) Commons DBCP aiming to fully follow the JDBC specs
 (making some of the behaviours optional reduced overhead for
  users that didn't want/need them)

 Filip therefore wrote tomcat-jdbc. He tried to release it several times
 without success. Apache releases need 3 +1 votes and there simply wasn't
 the interest in this component from the other Tomcat developers (this
 was one of my concerns with this approach).

 In order to get it released, tomcat-jdbc was bundled with Tomcat from
 7.0.19 onwards (July 2011) but it was never configured to be the default.

 Filip's focus at work moved away from Tomcat development in 2012. He
 does pop back from time to time (mainly to fix issues with tomcat-jdbc)
 but it is fair to say that - at the moment - issues in tomcat-jdbc are
 not being resolved in a timely manner.

 Around the same time tomcat-jdbc was bundled with Tomcat, I (and others
 from Commons) started on Commons Pool 2 and Commons DBCP 2. Pool 2 was
 finally released in 2013 and DBCP 2 in 2014 (Tomcat 8 always used DBCP 2
 and had been depending on snapshot versions for some time before that).

 Commons Pool 2 and Commons DBCP 2 continue to be maintained by the
 Commons community (there was a Pool 2.4.1 release just last week) and I
 aim to keep Tomcat's copy of DBCP 2 (and Pool 2) up to date.

 Generally, bugs reported against Commons DBCP2 and Commons Pool 2 are
 addressed in a timely manner.

 tomcat-jdbc provided (and continues to provide) a simple solution for
 those Tomcat 6 and Tomcat 7 users that needed better performance under
 concurrent loads. Tomcat 8 and onwards users have DBCP 2 so there is
 less need for tomcat-jdbc for those users.

 Hope this helps explain how we got to where we are.

 As I typed this, I started to wonder if we should even ship tomcat-jdbc
 with Tomcat 9. I'll start a discussion along those lines on the dev list.

 mark

 
  2015-06-02 16:59 GMT+03:00 Mark Thomas ma...@apache.org:
 
  On 01/06/2015 14:22, Tweak Ronaldo wrote:
  Hello guys,
 
  Assuming you don't want to limit your question to men only, you would be
  better to use of of the following greetings:
  Hello,
  Hello all,
  Hello folks,
 
  etc.
 
  we have migrated to Tomcat DBCP 8.0.18 from 7.0.37 recently and
  faced the following issue:
  after database restart (Postgres), our application wasn't been able to
  restore connectivity to DB, all connections were closed and every time,
  after failed attempt to execute some SQL statement, returned back to
  pool.
  Pool is configured with all tests (on borrow, on return, on connect,
  while
  idle) disabled. Pool configuration is the same for 8.0.18 and 7.0.37.
  While using 7.0.37 DBCP is able to restore from DB restart, because
  PoolableConnection class performs explicit check if underlying SQL
  connection is closed:
 
   public synchronized void close() throws SQLException {
  if (_closed) {
  // already closed
  return;
  }
 
  boolean isUnderlyingConectionClosed;
  try {
  isUnderlyingConectionClosed = _conn.isClosed();
  } catch

Re: Tomcat DBCP 8.0.18 issue

2015-06-03 Thread Mark Thomas
On 03/06/2015 07:24, Tweak Ronaldo wrote:
 Thanks Mark, yes I have mixed together Tomcat JDBC 8 and DBCP 7, my bad.
 Although I don't understand why Tomcat JDBC don't use DBCP as default
 solution for connections pooling.

Tomcat does - and always has - used Commons DBCP for connection pooling
by default.

We do package rename Commons DBCP to avoid conflicts for web
applications that package it in WEB-INF/lib and we have changed how we
have done that repackaging over the years but the source code remains
unchanged from which ever release version / tag / svn revision we select
to pull in.


What follows is a short(ish) history of Commons DBCP and tomcat-jdbc
which attempts to explain why Tomcat ended up shipping two connection pools.

Commons DBCP 1 has very poor performance in highly concurrent
environments. Things improved during the 1.x series but really didn't
improve much above 'awful'.

As users started to run Tomcat on machines with increasing numbers of
cores, the performance issues with DBCP 1 started to have a noticeable
impact for some web applications. Something needed to be done to address
the performance issues in concurrent environments.

There were two options:
a) fix DBCP (essentially this meant a major re-write for Commons Pool)
b) implement a new connection pool

My preference was for a) although I had little time to do any work along
those lines. Keep in mind that my preference for a) is likely to have
coloured my view of the history of this.

Filip's preference was for b). He also felt that there was room to
further improve performance by removing the overhead inherent in:
i)  Commons DBCP being built on Commons Pool
(a single module could be more tightly / efficiently integrated)
ii) Commons DBCP aiming to fully follow the JDBC specs
(making some of the behaviours optional reduced overhead for
 users that didn't want/need them)

Filip therefore wrote tomcat-jdbc. He tried to release it several times
without success. Apache releases need 3 +1 votes and there simply wasn't
the interest in this component from the other Tomcat developers (this
was one of my concerns with this approach).

In order to get it released, tomcat-jdbc was bundled with Tomcat from
7.0.19 onwards (July 2011) but it was never configured to be the default.

Filip's focus at work moved away from Tomcat development in 2012. He
does pop back from time to time (mainly to fix issues with tomcat-jdbc)
but it is fair to say that - at the moment - issues in tomcat-jdbc are
not being resolved in a timely manner.

Around the same time tomcat-jdbc was bundled with Tomcat, I (and others
from Commons) started on Commons Pool 2 and Commons DBCP 2. Pool 2 was
finally released in 2013 and DBCP 2 in 2014 (Tomcat 8 always used DBCP 2
and had been depending on snapshot versions for some time before that).

Commons Pool 2 and Commons DBCP 2 continue to be maintained by the
Commons community (there was a Pool 2.4.1 release just last week) and I
aim to keep Tomcat's copy of DBCP 2 (and Pool 2) up to date.

Generally, bugs reported against Commons DBCP2 and Commons Pool 2 are
addressed in a timely manner.

tomcat-jdbc provided (and continues to provide) a simple solution for
those Tomcat 6 and Tomcat 7 users that needed better performance under
concurrent loads. Tomcat 8 and onwards users have DBCP 2 so there is
less need for tomcat-jdbc for those users.

Hope this helps explain how we got to where we are.

As I typed this, I started to wonder if we should even ship tomcat-jdbc
with Tomcat 9. I'll start a discussion along those lines on the dev list.

mark

 
 2015-06-02 16:59 GMT+03:00 Mark Thomas ma...@apache.org:
 
 On 01/06/2015 14:22, Tweak Ronaldo wrote:
 Hello guys,

 Assuming you don't want to limit your question to men only, you would be
 better to use of of the following greetings:
 Hello,
 Hello all,
 Hello folks,

 etc.

 we have migrated to Tomcat DBCP 8.0.18 from 7.0.37 recently and
 faced the following issue:
 after database restart (Postgres), our application wasn't been able to
 restore connectivity to DB, all connections were closed and every time,
 after failed attempt to execute some SQL statement, returned back to
 pool.
 Pool is configured with all tests (on borrow, on return, on connect,
 while
 idle) disabled. Pool configuration is the same for 8.0.18 and 7.0.37.
 While using 7.0.37 DBCP is able to restore from DB restart, because
 PoolableConnection class performs explicit check if underlying SQL
 connection is closed:

  public synchronized void close() throws SQLException {
 if (_closed) {
 // already closed
 return;
 }

 boolean isUnderlyingConectionClosed;
 try {
 isUnderlyingConectionClosed = _conn.isClosed();
 } catch (SQLException e) {
 try {
 _pool.invalidateObject(this); // XXX should be guarded to
 happen at most once
 } catch(IllegalStateException ise

Re: Tomcat DBCP 8.0.18 issue

2015-06-03 Thread Tweak Ronaldo
Thanks Mark, yes I have mixed together Tomcat JDBC 8 and DBCP 7, my bad.
Although I don't understand why Tomcat JDBC don't use DBCP as default
solution for connections pooling.

2015-06-02 16:59 GMT+03:00 Mark Thomas ma...@apache.org:

 On 01/06/2015 14:22, Tweak Ronaldo wrote:
  Hello guys,

 Assuming you don't want to limit your question to men only, you would be
 better to use of of the following greetings:
 Hello,
 Hello all,
 Hello folks,

 etc.

  we have migrated to Tomcat DBCP 8.0.18 from 7.0.37 recently and
  faced the following issue:
  after database restart (Postgres), our application wasn't been able to
  restore connectivity to DB, all connections were closed and every time,
  after failed attempt to execute some SQL statement, returned back to
 pool.
  Pool is configured with all tests (on borrow, on return, on connect,
 while
  idle) disabled. Pool configuration is the same for 8.0.18 and 7.0.37.
  While using 7.0.37 DBCP is able to restore from DB restart, because
  PoolableConnection class performs explicit check if underlying SQL
  connection is closed:
 
   public synchronized void close() throws SQLException {
  if (_closed) {
  // already closed
  return;
  }
 
  boolean isUnderlyingConectionClosed;
  try {
  isUnderlyingConectionClosed = _conn.isClosed();
  } catch (SQLException e) {
  try {
  _pool.invalidateObject(this); // XXX should be guarded to
  happen at most once
  } catch(IllegalStateException ise) {
  // pool is closed, so close the connection
  passivate();
  getInnermostDelegate().close();
  } catch (Exception ie) {
  // DO NOTHING the original exception will be rethrown
  }
  throw (SQLException) new SQLException(Cannot close
 connection
  (isClosed check failed)).initCause(e);
  }
 ...
 
  My question is: why this check was removed and how can one get the same
  behaviour (of 7.0.37) using 8.0.18 (not using on borrow, on return, while
  idle validations, which are SQL queries)? I see that there is a property
 in
  pool configuration which allows user to provide custom Validator, though
 I
  don't want to go this way because DBCP configuration is performed by 3rd
  party library and we don't have direct access to it.

 The check to which you refer was not removed. It is still present in the
 code base and - as far as I can tell from a quick look at svn - never
 been removed.

 DBCP has no support for a custom validator. You appear to have confused
 something else with Tomcat's port of Commons DBCP (the Tomcat JDBC pool
 perhaps?).

 Mark


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




Re: Tomcat DBCP 8.0.18 issue

2015-06-03 Thread Антон Мацюк
Mark, big thanks for a quick historical review, it was very intreresting!
I was thinking that tomcat-jdbc is something new, but wasn't sure about
project maintenance.

2015-06-03 12:22 GMT+03:00 Mark Thomas ma...@apache.org:

 On 03/06/2015 07:24, Tweak Ronaldo wrote:
  Thanks Mark, yes I have mixed together Tomcat JDBC 8 and DBCP 7, my bad.
  Although I don't understand why Tomcat JDBC don't use DBCP as default
  solution for connections pooling.

 Tomcat does - and always has - used Commons DBCP for connection pooling
 by default.

 We do package rename Commons DBCP to avoid conflicts for web
 applications that package it in WEB-INF/lib and we have changed how we
 have done that repackaging over the years but the source code remains
 unchanged from which ever release version / tag / svn revision we select
 to pull in.


 What follows is a short(ish) history of Commons DBCP and tomcat-jdbc
 which attempts to explain why Tomcat ended up shipping two connection
 pools.

 Commons DBCP 1 has very poor performance in highly concurrent
 environments. Things improved during the 1.x series but really didn't
 improve much above 'awful'.

 As users started to run Tomcat on machines with increasing numbers of
 cores, the performance issues with DBCP 1 started to have a noticeable
 impact for some web applications. Something needed to be done to address
 the performance issues in concurrent environments.

 There were two options:
 a) fix DBCP (essentially this meant a major re-write for Commons Pool)
 b) implement a new connection pool

 My preference was for a) although I had little time to do any work along
 those lines. Keep in mind that my preference for a) is likely to have
 coloured my view of the history of this.

 Filip's preference was for b). He also felt that there was room to
 further improve performance by removing the overhead inherent in:
 i)  Commons DBCP being built on Commons Pool
 (a single module could be more tightly / efficiently integrated)
 ii) Commons DBCP aiming to fully follow the JDBC specs
 (making some of the behaviours optional reduced overhead for
  users that didn't want/need them)

 Filip therefore wrote tomcat-jdbc. He tried to release it several times
 without success. Apache releases need 3 +1 votes and there simply wasn't
 the interest in this component from the other Tomcat developers (this
 was one of my concerns with this approach).

 In order to get it released, tomcat-jdbc was bundled with Tomcat from
 7.0.19 onwards (July 2011) but it was never configured to be the default.

 Filip's focus at work moved away from Tomcat development in 2012. He
 does pop back from time to time (mainly to fix issues with tomcat-jdbc)
 but it is fair to say that - at the moment - issues in tomcat-jdbc are
 not being resolved in a timely manner.

 Around the same time tomcat-jdbc was bundled with Tomcat, I (and others
 from Commons) started on Commons Pool 2 and Commons DBCP 2. Pool 2 was
 finally released in 2013 and DBCP 2 in 2014 (Tomcat 8 always used DBCP 2
 and had been depending on snapshot versions for some time before that).

 Commons Pool 2 and Commons DBCP 2 continue to be maintained by the
 Commons community (there was a Pool 2.4.1 release just last week) and I
 aim to keep Tomcat's copy of DBCP 2 (and Pool 2) up to date.

 Generally, bugs reported against Commons DBCP2 and Commons Pool 2 are
 addressed in a timely manner.

 tomcat-jdbc provided (and continues to provide) a simple solution for
 those Tomcat 6 and Tomcat 7 users that needed better performance under
 concurrent loads. Tomcat 8 and onwards users have DBCP 2 so there is
 less need for tomcat-jdbc for those users.

 Hope this helps explain how we got to where we are.

 As I typed this, I started to wonder if we should even ship tomcat-jdbc
 with Tomcat 9. I'll start a discussion along those lines on the dev list.

 mark

 
  2015-06-02 16:59 GMT+03:00 Mark Thomas ma...@apache.org:
 
  On 01/06/2015 14:22, Tweak Ronaldo wrote:
  Hello guys,
 
  Assuming you don't want to limit your question to men only, you would be
  better to use of of the following greetings:
  Hello,
  Hello all,
  Hello folks,
 
  etc.
 
  we have migrated to Tomcat DBCP 8.0.18 from 7.0.37 recently and
  faced the following issue:
  after database restart (Postgres), our application wasn't been able to
  restore connectivity to DB, all connections were closed and every time,
  after failed attempt to execute some SQL statement, returned back to
  pool.
  Pool is configured with all tests (on borrow, on return, on connect,
  while
  idle) disabled. Pool configuration is the same for 8.0.18 and 7.0.37.
  While using 7.0.37 DBCP is able to restore from DB restart, because
  PoolableConnection class performs explicit check if underlying SQL
  connection is closed:
 
   public synchronized void close() throws SQLException {
  if (_closed) {
  // already closed
  return;
  }
 
  boolean

Re: Tomcat DBCP 8.0.18 issue

2015-06-02 Thread Konstantin Kolinko
2015-06-01 16:22 GMT+03:00 Tweak Ronaldo twea...@gmail.com:
 Hello guys, we have migrated to Tomcat DBCP 8.0.18 from 7.0.37 recently and
 faced the following issue:
 after database restart (Postgres), our application wasn't been able to
 restore connectivity to DB, all connections were closed and every time,
 after failed attempt to execute some SQL statement, returned back to pool.
 Pool is configured with all tests (on borrow, on return, on connect, while
 idle) disabled. Pool configuration is the same for 8.0.18 and 7.0.37.

the same?
Tomcat 7 uses DBCP 1 and Tomcat 8 uses DBCP 2, where some attributes
have different names.

As mentioned in migration guide:
http://tomcat.apache.org/migration-8.html#Database_Connection_Pooling

Best regards,
Konstantin Kolinko

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



Re: Tomcat DBCP 8.0.18 issue

2015-06-02 Thread Mark Thomas
On 01/06/2015 14:22, Tweak Ronaldo wrote:
 Hello guys,

Assuming you don't want to limit your question to men only, you would be
better to use of of the following greetings:
Hello,
Hello all,
Hello folks,

etc.

 we have migrated to Tomcat DBCP 8.0.18 from 7.0.37 recently and
 faced the following issue:
 after database restart (Postgres), our application wasn't been able to
 restore connectivity to DB, all connections were closed and every time,
 after failed attempt to execute some SQL statement, returned back to pool.
 Pool is configured with all tests (on borrow, on return, on connect, while
 idle) disabled. Pool configuration is the same for 8.0.18 and 7.0.37.
 While using 7.0.37 DBCP is able to restore from DB restart, because
 PoolableConnection class performs explicit check if underlying SQL
 connection is closed:
 
  public synchronized void close() throws SQLException {
 if (_closed) {
 // already closed
 return;
 }
 
 boolean isUnderlyingConectionClosed;
 try {
 isUnderlyingConectionClosed = _conn.isClosed();
 } catch (SQLException e) {
 try {
 _pool.invalidateObject(this); // XXX should be guarded to
 happen at most once
 } catch(IllegalStateException ise) {
 // pool is closed, so close the connection
 passivate();
 getInnermostDelegate().close();
 } catch (Exception ie) {
 // DO NOTHING the original exception will be rethrown
 }
 throw (SQLException) new SQLException(Cannot close connection
 (isClosed check failed)).initCause(e);
 }
...
 
 My question is: why this check was removed and how can one get the same
 behaviour (of 7.0.37) using 8.0.18 (not using on borrow, on return, while
 idle validations, which are SQL queries)? I see that there is a property in
 pool configuration which allows user to provide custom Validator, though I
 don't want to go this way because DBCP configuration is performed by 3rd
 party library and we don't have direct access to it.

The check to which you refer was not removed. It is still present in the
code base and - as far as I can tell from a quick look at svn - never
been removed.

DBCP has no support for a custom validator. You appear to have confused
something else with Tomcat's port of Commons DBCP (the Tomcat JDBC pool
perhaps?).

Mark


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



Tomcat DBCP 8.0.18 issue

2015-06-01 Thread Tweak Ronaldo
Hello guys, we have migrated to Tomcat DBCP 8.0.18 from 7.0.37 recently and
faced the following issue:
after database restart (Postgres), our application wasn't been able to
restore connectivity to DB, all connections were closed and every time,
after failed attempt to execute some SQL statement, returned back to pool.
Pool is configured with all tests (on borrow, on return, on connect, while
idle) disabled. Pool configuration is the same for 8.0.18 and 7.0.37.
While using 7.0.37 DBCP is able to restore from DB restart, because
PoolableConnection class performs explicit check if underlying SQL
connection is closed:

 public synchronized void close() throws SQLException {
if (_closed) {
// already closed
return;
}

boolean isUnderlyingConectionClosed;
try {
isUnderlyingConectionClosed = _conn.isClosed();
} catch (SQLException e) {
try {
_pool.invalidateObject(this); // XXX should be guarded to
happen at most once
} catch(IllegalStateException ise) {
// pool is closed, so close the connection
passivate();
getInnermostDelegate().close();
} catch (Exception ie) {
// DO NOTHING the original exception will be rethrown
}
throw (SQLException) new SQLException(Cannot close connection
(isClosed check failed)).initCause(e);
}
   ...

My question is: why this check was removed and how can one get the same
behaviour (of 7.0.37) using 8.0.18 (not using on borrow, on return, while
idle validations, which are SQL queries)? I see that there is a property in
pool configuration which allows user to provide custom Validator, though I
don't want to go this way because DBCP configuration is performed by 3rd
party library and we don't have direct access to it.


tomcat-jdbc vs. tomcat-dbcp

2014-11-28 Thread Christian
Hi,

reading tomcat 8.x documentation, I don't find anything about tomcat-dbcp. The 
use of tomcat-jdbc is described at [1].
Some of the disadvantages just apply for DBCP 1.x.
Is the use of tomcat-jdbc still recommended compared to the repackaged DBCP 2.x 
in tomcat-dbcp package?

Regards,
Christian

[1] https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html

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



Re: tomcat-jdbc vs. tomcat-dbcp

2014-11-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Christian,

On 11/28/14 7:57 AM, Christian wrote:
 reading tomcat 8.x documentation, I don't find anything about 
 tomcat-dbcp. The use of tomcat-jdbc is described at [1]. Some of 
 the disadvantages just apply for DBCP 1.x. Is the use of 
 tomcat-jdbc still recommended compared to the repackaged DBCP 2.x 
 in tomcat-dbcp package?
 
 Regards, Christian
 
 [1] https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html

Tomcat 8 comes with DBCP 2.x which is an improvement over DBCP 1.x and
the differences between DBCP 2.x and tomcat-pool are somewhat less
important.

tomcat-pool supports some additional nice-to-have features and has a
bit less overhead in terms of API size (class count) and so from a
virtual-method standpoint ought to be a tiny bit faster, but not so
much that you'd notice given that SQL queries take hundreds,
thousands, or millions of times more time to execute than method
invocations.

So, my recommendation is to choose whichever pool has the features
that you require and doesn't take too much fussing to configure
properly. Since Tomcat's default pool is based upon DBCP, it's likely
to be slightly easier to configure that one over tomcat-pool.

You can always benchmark in your environment to determine if
performance is a factor for you.

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

iQIcBAEBCAAGBQJUeId/AAoJEBzwKT+lPKRYr9oQAMWWkXoOMrrYRhHyGGneON7Q
dqDO2KjyNohoq+1ECzTtBmfkLtKuln9ilzt10H0MBbS0IXp+Ng/QibNoocF/W2yV
dKkh1QcfzH2jDE00ClSLFpoD7KxQ8mTh2XZWK+E22Iyixb0PehQASV+nVkrTyIqD
hF2jOCzmfn4G41W+P194q3lO7n3SqQIKcWvhcWYhxSyQMODksQsJMYDm6fU6thuO
PprCIq2UdDAQTqOSatbHslGg0zqj4qVt7avffbM+NCJn9zRzjgjnkGdHjAbP1NPG
BXmaGuNc22vV4pDbjS2ljgn/jtWu0K6IgxFIdLL/eguCUvtmn0OlIPyF3omPm70o
+DKDf22ME+aOcAZvCFanSAkTe95XktGBx6KPPrwRLjSJbM/OL3wt6Sktih9ULxfU
nMfMQ0eAUqRK4P9DN85E2zmZ76e+pTEpmgkuIYdrk4L66oudaBesLODfZYUy9Jon
0AsZEjVPouY5w+V51FWu8P29MWS33af+O4kNCK31SdEHx5FziLuNY43L1vIYDIIA
N1729D4b+J3fUsmPvF0JDn0VBPTnz4Hj1Vb5uYvbLm3rE3Bz+UDpuGdcw2z2FLkF
vNzVhWCVN8XNnz3VZd/mtZ8OUVPE2tcAbBX5P9bjxn8BUtE2mLyCx14E6yJOgz6p
061pxnx6KRu4LfswR+BM
=lq6D
-END PGP SIGNATURE-

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



Tomcat DBCP Logging

2013-03-06 Thread Rahul Somasunderam
Hi,

I'm running Tomcat 7.0.23. I've got a question about configuring the logging of 
DBCP Failures. 

I've go this in my context xml file.

Context docBase=/home/foo/war/ path=/foo reloadable=true
   Resource
   name=jdbc/hd/datasource
   auth=Container
   type=javax.sql.DataSource
   driverClassName=oracle.jdbc.OracleDriver
   url=jdbc:oracle:thin:@//localhost:1531/PROD
   username=foouser
   password=foopass
   /
/Context

When the username and password are correct, I have no trouble connecting and my 
application works as expected.
However when this is wrong, I get no indication of why it went wrong. I suppose 
Tomcat/DBCP is catching the exception and not logging it.
When I try from outside of tomcat using jdbc, I see Oracle returning a 
ORA-01017 error code and jdbc throwing an exception.

What must I do in the logging.properties to make tomcat log this?

R,
rahul

smime.p7s
Description: S/MIME cryptographic signature


Re: Tomcat DBCP Logging

2013-03-06 Thread Daniel Mikusa
On Mar 6, 2013, at 1:49 PM, Rahul Somasunderam wrote:

 Hi,
 
 I'm running Tomcat 7.0.23.

This is getting pretty old, you might want to consider upgrading.

 I've got a question about configuring the logging of DBCP Failures. 
 
 I've go this in my context xml file.
 
 Context docBase=/home/foo/war/ path=/foo reloadable=true
   Resource
   name=jdbc/hd/datasource
   auth=Container
   type=javax.sql.DataSource
   driverClassName=oracle.jdbc.OracleDriver
   url=jdbc:oracle:thin:@//localhost:1531/PROD
   username=foouser
   password=foopass
   /
 /Context
 
 When the username and password are correct, I have no trouble connecting and 
 my application works as expected.
 However when this is wrong, I get no indication of why it went wrong.

When it's wrong what happens?  How are you testing for failure?  Are you 
accessing a page in your app that requires the DB?

 I suppose Tomcat/DBCP is catching the exception and not logging it.

Hard to say for sure, but it's possible that DBCP may not even be connecting to 
the Database.  The initialSize parameter defaults to 0, so on startup it 
won't make any connections.  Maybe try setting initialSize to 1 and see 
what happens.

  https://commons.apache.org/dbcp/configuration.html

Dan

 When I try from outside of tomcat using jdbc, I see Oracle returning a 
 ORA-01017 error code and jdbc throwing an exception.
 
 What must I do in the logging.properties to make tomcat log this?
 
 R,
 rahul

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



Re: Tomcat DBCP Logging

2013-03-06 Thread Rahul Somasunderam

On Mar 6, 2013, at 11:26 AM, Daniel Mikusa dmik...@vmware.com wrote:

 On Mar 6, 2013, at 1:49 PM, Rahul Somasunderam wrote:
 
 Hi,
 
 I'm running Tomcat 7.0.23.
 
 This is getting pretty old, you might want to consider upgrading.

I will, but I don't think this has to do much with tomcat being old. I think 
it's with me having to configure the logging correctly.

 
 I've got a question about configuring the logging of DBCP Failures. 
 
 I've go this in my context xml file.
 
 Context docBase=/home/foo/war/ path=/foo reloadable=true
  Resource
  name=jdbc/hd/datasource
  auth=Container
  type=javax.sql.DataSource
  driverClassName=oracle.jdbc.OracleDriver
  url=jdbc:oracle:thin:@//localhost:1531/PROD
  username=foouser
  password=foopass
  /
 /Context
 
 When the username and password are correct, I have no trouble connecting and 
 my application works as expected.
 However when this is wrong, I get no indication of why it went wrong.
 
 When it's wrong what happens?  How are you testing for failure?  Are you 
 accessing a page in your app that requires the DB?

I'm testing this by changing the password in my context to be a wrong password. 
I'm looking at the startup logs and I see this in catalina.out

Mar 06, 2013 11:57:27 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Mar 06, 2013 11:57:27 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/foo] startup failed due to previous errors

And this in localhost.date.log

Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: 
attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 
'org.apache.jasper.compiler.TldLocationsCache@1296dee6')
Mar 06, 2013 11:56:55 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log


 
 I suppose Tomcat/DBCP is catching the exception and not logging it.
 
 Hard to say for sure, but it's possible that DBCP may not even be connecting 
 to the Database.  The initialSize parameter defaults to 0, so on startup it 
 won't make any connections.  Maybe try setting initialSize to 1 and see 
 what happens.
 
  https://commons.apache.org/dbcp/configuration.html
 
 Dan
 
 When I try from outside of tomcat using jdbc, I see Oracle returning a 
 ORA-01017 error code and jdbc throwing an exception.
 
 What must I do in the logging.properties to make tomcat log this?
 
 R,
 rahul
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 



smime.p7s
Description: S/MIME cryptographic signature


Re: Tomcat DBCP Logging

2013-03-06 Thread Daniel Mikusa
On Mar 6, 2013, at 5:07 PM, Rahul Somasunderam wrote:

 
 On Mar 6, 2013, at 11:26 AM, Daniel Mikusa dmik...@vmware.com wrote:
 
 On Mar 6, 2013, at 1:49 PM, Rahul Somasunderam wrote:
 
 Hi,
 
 I'm running Tomcat 7.0.23.
 
 This is getting pretty old, you might want to consider upgrading.
 
 I will, but I don't think this has to do much with tomcat being old. I think 
 it's with me having to configure the logging correctly.

You're right, this is not related to the issue at hand.  It's just a general 
reminder :)

 
 
 I've got a question about configuring the logging of DBCP Failures. 
 
 I've go this in my context xml file.
 
 Context docBase=/home/foo/war/ path=/foo reloadable=true
 Resource
 name=jdbc/hd/datasource
 auth=Container
 type=javax.sql.DataSource
 driverClassName=oracle.jdbc.OracleDriver
 url=jdbc:oracle:thin:@//localhost:1531/PROD
 username=foouser
 password=foopass
 /
 /Context
 
 When the username and password are correct, I have no trouble connecting 
 and my application works as expected.
 However when this is wrong, I get no indication of why it went wrong.
 
 When it's wrong what happens?  How are you testing for failure?  Are you 
 accessing a page in your app that requires the DB?
 
 I'm testing this by changing the password in my context to be a wrong 
 password. I'm looking at the startup logs and I see this in catalina.out
 
 Mar 06, 2013 11:57:27 AM org.apache.catalina.core.StandardContext 
 startInternal
 SEVERE: Error listenerStart
 Mar 06, 2013 11:57:27 AM org.apache.catalina.core.StandardContext 
 startInternal
 SEVERE: Context [/foo] startup failed due to previous errors

Your application failed to start for some reason.  It appears that a listener 
has failed.  You should check the other Tomcat log files and your application 
log files for clues.

 
 And this in localhost.date.log
 
 Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
 INFO: ContextListener: contextInitialized()
 Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
 INFO: SessionListener: contextInitialized()
 Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
 INFO: ContextListener: 
 attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 
 'org.apache.jasper.compiler.TldLocationsCache@1296dee6')
 Mar 06, 2013 11:56:55 AM org.apache.catalina.core.ApplicationContext log
 INFO: Initializing Spring root WebApplicationContext
 Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log
 INFO: ContextListener: contextInitialized()
 Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log
 INFO: SessionListener: contextInitialized()
 Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log

Is this the entire localhost.-MM-DD.log file?  Given the SEVERE log in 
catalina.out, I would have expected an exception here.

Dan

PS.  Have you tried setting the initialSize attribute on your Resource / 
tag?  That should force DBCP to create a connection at startup and, if that 
connection fails, it should log it.  I tested this in my Tomcat setup, with an 
out-of-the-box logging configuration, and it worked fine.


 
 
 I suppose Tomcat/DBCP is catching the exception and not logging it.
 
 Hard to say for sure, but it's possible that DBCP may not even be connecting 
 to the Database.  The initialSize parameter defaults to 0, so on startup 
 it won't make any connections.  Maybe try setting initialSize to 1 and 
 see what happens.
 
 https://commons.apache.org/dbcp/configuration.html
 
 Dan
 
 When I try from outside of tomcat using jdbc, I see Oracle returning a 
 ORA-01017 error code and jdbc throwing an exception.
 
 What must I do in the logging.properties to make tomcat log this?
 
 R,
 rahul
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 

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



Re: Tomcat DBCP Logging

2013-03-06 Thread Rahul Somasunderam
Thanks Dan,

The initialSize brought the logs into my catalina.out.

R,
rahul

On Mar 6, 2013, at 2:21 PM, Daniel Mikusa dmik...@vmware.com wrote:

 On Mar 6, 2013, at 5:07 PM, Rahul Somasunderam wrote:
 
 
 On Mar 6, 2013, at 11:26 AM, Daniel Mikusa dmik...@vmware.com wrote:
 
 On Mar 6, 2013, at 1:49 PM, Rahul Somasunderam wrote:
 
 Hi,
 
 I'm running Tomcat 7.0.23.
 
 This is getting pretty old, you might want to consider upgrading.
 
 I will, but I don't think this has to do much with tomcat being old. I think 
 it's with me having to configure the logging correctly.
 
 You're right, this is not related to the issue at hand.  It's just a general 
 reminder :)
 
 
 
 I've got a question about configuring the logging of DBCP Failures. 
 
 I've go this in my context xml file.
 
 Context docBase=/home/foo/war/ path=/foo reloadable=true
 Resource
name=jdbc/hd/datasource
auth=Container
type=javax.sql.DataSource
driverClassName=oracle.jdbc.OracleDriver
url=jdbc:oracle:thin:@//localhost:1531/PROD
username=foouser
password=foopass
 /
 /Context
 
 When the username and password are correct, I have no trouble connecting 
 and my application works as expected.
 However when this is wrong, I get no indication of why it went wrong.
 
 When it's wrong what happens?  How are you testing for failure?  Are you 
 accessing a page in your app that requires the DB?
 
 I'm testing this by changing the password in my context to be a wrong 
 password. I'm looking at the startup logs and I see this in catalina.out
 
 Mar 06, 2013 11:57:27 AM org.apache.catalina.core.StandardContext 
 startInternal
 SEVERE: Error listenerStart
 Mar 06, 2013 11:57:27 AM org.apache.catalina.core.StandardContext 
 startInternal
 SEVERE: Context [/foo] startup failed due to previous errors
 
 Your application failed to start for some reason.  It appears that a listener 
 has failed.  You should check the other Tomcat log files and your application 
 log files for clues.
 
 
 And this in localhost.date.log
 
 Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
 INFO: ContextListener: contextInitialized()
 Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
 INFO: SessionListener: contextInitialized()
 Mar 06, 2013 10:13:17 AM org.apache.catalina.core.ApplicationContext log
 INFO: ContextListener: 
 attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 
 'org.apache.jasper.compiler.TldLocationsCache@1296dee6')
 Mar 06, 2013 11:56:55 AM org.apache.catalina.core.ApplicationContext log
 INFO: Initializing Spring root WebApplicationContext
 Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log
 INFO: ContextListener: contextInitialized()
 Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log
 INFO: SessionListener: contextInitialized()
 Mar 06, 2013 11:58:57 AM org.apache.catalina.core.ApplicationContext log
 
 Is this the entire localhost.-MM-DD.log file?  Given the SEVERE log in 
 catalina.out, I would have expected an exception here.
 
 Dan
 
 PS.  Have you tried setting the initialSize attribute on your Resource / 
 tag?  That should force DBCP to create a connection at startup and, if that 
 connection fails, it should log it.  I tested this in my Tomcat setup, with 
 an out-of-the-box logging configuration, and it worked fine.
 
 
 
 
 I suppose Tomcat/DBCP is catching the exception and not logging it.
 
 Hard to say for sure, but it's possible that DBCP may not even be 
 connecting to the Database.  The initialSize parameter defaults to 0, so 
 on startup it won't make any connections.  Maybe try setting initialSize 
 to 1 and see what happens.
 
 https://commons.apache.org/dbcp/configuration.html
 
 Dan
 
 When I try from outside of tomcat using jdbc, I see Oracle returning a 
 ORA-01017 error code and jdbc throwing an exception.
 
 What must I do in the logging.properties to make tomcat log this?
 
 R,
 rahul
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 



smime.p7s
Description: S/MIME cryptographic signature


Re: Tomcat DBCP Logging

2013-03-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Rahul,

On 3/6/13 12:49 PM, Rahul Somasunderam wrote:
 I'm running Tomcat 7.0.23. I've got a question about configuring
 the logging of DBCP Failures.

Echoing Daniel's suggestion: upgrade.

 I've go this in my context xml file.
 
 Context docBase=/home/foo/war/ path=/foo reloadable=true

The path attribute is illegal, here: remove it.

 Resource name=jdbc/hd/datasource auth=Container 
 type=javax.sql.DataSource 
 driverClassName=oracle.jdbc.OracleDriver 
 url=jdbc:oracle:thin:@//localhost:1531/PROD username=foouser 
 password=foopass /

Resource looks good: you confirm that it works properly when
username/password are correct.

 When the username and password are correct, I have no trouble 
 connecting and my application works as expected. However when this
 is wrong, I get no indication of why it went wrong. I suppose
 Tomcat/DBCP is catching the exception and not logging it.

Nope: Tomcat/DBCP does not catch any of these exceptions. If I change
my username/password to incorrect ones, I get an exception for each
connection attempt. My application code catches the exception and logs
it appropriately.

If you fetch the connection in a JSP and don't have any catch blocks,
the JSP compiler adds try/catch for you and re-throws the exception as
a ServletException -- servlet can only throw ServletException and
IOException.

If you use some framework (Spring, Struts, etc.) with a
front-controller, they can all be configured with their own error
handlers: perhaps you have poorly-configured one of these components.

If you wrote your own servlet, then you should read your own code
because you are probably catching and swallowing these exceptions.

How do you fetch a connection from the pool?

 When I try from outside of tomcat using jdbc, I see Oracle
 returning a ORA-01017 error code and jdbc throwing an exception.
 
 What must I do in the logging.properties to make tomcat log this?

AFAIK, nothing: Tomcat should log any uncaught exception. Do you get a
Tomcat 500 response page with a stack trace? If not, some other
component (under /your/ control) is handling the exception - and not
the way you want it to.

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

iEYEAREIAAYFAlE4IWkACgkQ9CaO5/Lv0PBAHACgkklRQ3gHYFuYrahND3bOtW8C
xsYAn0yw1zEGnQkNV3JxCaR48TrJOjHO
=8CKa
-END PGP SIGNATURE-

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



Re: Tomcat DBCP SQLServer failover

2012-10-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jose,

On 10/11/12 3:31 PM, Jose María Zaragoza wrote:
 How can you tell the difference between a primary server being
 down and the primary server needing to (otherwise?) fail-over
 to the backup? I'm confused about your nomenclature (primary
 failover means mirror - primary?).
 
 Well, I'm newbie in SQLServer but I think that  primary and mirror
 are sending message to each other ( mirroring session ) When
 primary fails, mirror becomes the primary
 
 About SQLServer documentation, when a connection is established to
 a primary server (which is on a mirroring session) , is returned to
 it the configuration of the mirror ( who is the primary, who is
 the mirror ). So, if there is a fail when you are using that
 connection, a SQLException is thrown . About the SQLServer  , you
 must close that connection and get a new one. In theory, this new
 connections knows what is the right server to connect ( driver
 knows it )
 
 So, this is my question: what does happen with connections living
 at pool ?

It sounds like just with any other database: if you enable a
validationQuery then failover (or any kind) will be transparent to the
application: DBCP will test the connection, if failover occurs a
SQLException if thrown, DBCP catches that exception, closes the
connection, and creates a new one. The driver should know about the
failover and connect to the secondary server and return a fresh
Connection, which gets returned to the application. I don't know how
many times DBCP will repeat this for a single getConnection call.

The pool will slowly turn-over as the application requests (now
invalid) connections and each of them will be refreshed as needed.

 AFAIK, DBCP knows nothing about failover: all that stuff happens
 at the JDBC driver-level.
 
 I agree with you. Because of that,  I've got that question :-)

Hopefully I've answered it..?

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

iEYEARECAAYFAlB4KFIACgkQ9CaO5/Lv0PCoJwCdGug2+jVGrKS+xn+mEQxvj1JT
Me4AoK2UcvPgN2HUDaUpXkhgPpC1vKVW
=HlLC
-END PGP SIGNATURE-

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



Re: Tomcat DBCP SQLServer failover

2012-10-12 Thread Jose María Zaragoza

 I agree with you. Because of that,  I've got that question :-)

 Hopefully I've answered it..?

 - -chris

A lof of thanks, Chris.
I'm going to test it and I'll make feedback to the list

Regards

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



Re: Tomcat DBCP SQLServer failover

2012-10-11 Thread Jose María Zaragoza
 How can you tell the difference between a primary server being down
 and the primary server needing to (otherwise?) fail-over to the
 backup? I'm confused about your nomenclature (primary failover means
 mirror - primary?).

Well, I'm newbie in SQLServer but I think that  primary and mirror are
sending message to each other ( mirroring session )
When primary fails, mirror becomes the primary

About SQLServer documentation, when a connection is established to a
primary server (which is on a mirroring session) , is returned to it
the configuration of the mirror ( who is the primary, who is the
mirror ).
So, if there is a fail when you are using that connection, a
SQLException is thrown . About the SQLServer  , you must close that
connection and get a new one. In theory, this new connections knows
what is the right server to connect ( driver knows it )

So, this is my question: what does happen with connections living at pool ?


 AFAIK, DBCP knows nothing about failover: all that stuff happens at
 the JDBC driver-level.

I agree with you. Because of that,  I've got that question :-)


Thanks and regards

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



Tomcat DBCP SQLServer failover

2012-10-10 Thread Jose María Zaragoza
Hi:

I want to add  database failover to my web application
I use Tomcat 6 and SQLServer database + JDBC Driver 3.0

I'm getting connections from datasource with

DataSource ds = ic.lookup(java:comp/env/jdbc/mydb);
Connection con = ds.getConnection();

I know that I've got to define a DN like
jdbc:sqlserver://DEVSQLB\SQLB;databaseName=db_space;portNumber=;failoverPartner=BACKUPSQLA\SQLA;


But my doubts are about what happen with pooled connections.
The scenario is my pool is populated by connections to primary server.
Then, the primary server fails and a failover happens ( mirror -
primary )
I'm not talking about the case where the primary server is down and
DBCP tries to create new connections

About  SQLServer documentation

When the principal database server fails, the client application
receives errors in response to API calls, which indicate that the
connection to the database has been lost. When this occurs, any
uncommitted changes to the database are lost and the current
transaction is rolled back. If this occurs, the application should
close the connection (or release the data source object) and try to
reopen it. On connection, the new connection is transparently
re-directed to the mirror database, which now acts as the principal
server, without the client having to modify the connection string or
data source object.

If I close my connection ( con ) , I returns it to connection pool,
and I'll have a bad connection in the pool.
If I get another bew connection with Connection con =
ds.getConnection(),  i'll retrieve from the pool connection and it
will be a bad connection.

In conclusion, all old connections in my pool will be bad
connections after the principal database server fails
I'd need to release all old connections and create new connections ( I
don't know how these connections know what is the primary server now ,
I''llbelieve it )

How do you resolve the failover mechanism when connections are
retrieved from a connection pool ?
Do I need to clear the pool when a failover happens ?
Would a ping query in datasource solve this issue ?


Thanks and regards

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



Re: Tomcat DBCP SQLServer failover

2012-10-10 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jose María,

On 10/10/12 3:00 PM, Jose María Zaragoza wrote:
 I want to add  database failover to my web application I use Tomcat
 6 and SQLServer database + JDBC Driver 3.0
 
 But my doubts are about what happen with pooled connections. The
 scenario is my pool is populated by connections to primary server. 
 Then, the primary server fails and a failover happens ( mirror - 
 primary ) I'm not talking about the case where the primary server
 is down and DBCP tries to create new connections

How can you tell the difference between a primary server being down
and the primary server needing to (otherwise?) fail-over to the
backup? I'm confused about your nomenclature (primary failover means
mirror - primary?).

AFAIK, DBCP knows nothing about failover: all that stuff happens at
the JDBC driver-level.

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

iEYEARECAAYFAlB157oACgkQ9CaO5/Lv0PAcBgCgpuWvOxpz0fdSJGddJYiV1UZN
nlcAnRxO2/SA4DOi1YJ+PseFuOUacEvJ
=8ijB
-END PGP SIGNATURE-

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



Re: Tomcat DBCP Connection pool issue

2012-06-28 Thread Kiran Badi

On 6/27/2012 8:35 PM, Christopher Schultz wrote:

100 active db connections sounds like a lot. Do you really need to
support 100 simultaneous connections to your database? Can your
database support that many connections with active queries from each?
Do you have a cluster? Remember that each member in the cluster will
therefore open a maximum of 100 connections to your database. 10
cluster members means 1000 simultaneous connections.
to begin with I am targetting 1000 users at any time.I know this is too 
much to dream off.But again let me try for that.


I will enable abondered detection settings.Thanks for bringing to notice.

There's no time like the present: this problem will only get worse
over time.

I had written a bunch of DAO  classes sometimes back,but there was bug in DB 
design(for one functionality,I forgot to relate tables properly) and after 
fixing that I somehow forgot to to use model 2 design(again my bad its hard to 
wire the brain to work this way when you can just make easy calls and then 
present data to the client and yet do MVC) and started working  old way and due 
to this db calls went into the servlet.For other module I am fixing this and 
will make action servlet which will read request uri and then do the 
appropriate action.I have almost visualised,inserts and deletes.Trying to find 
the way to see how to make edit work.I have around 10 images and around 10 
fields which I need to perists somewhere before final insert.

God bless me.




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



Re: Tomcat DBCP Connection pool issue

2012-06-27 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kiran,

On 6/26/12 7:24 PM, Kiran Badi wrote:
 Resource name=jdbc/mysitedb auth=Container 
 type=javax.sql.DataSource maxActive=100 maxIdle=30
 maxWait=1

100 active db connections sounds like a lot. Do you really need to
support 100 simultaneous connections to your database? Can your
database support that many connections with active queries from each?
Do you have a cluster? Remember that each member in the cluster will
therefore open a maximum of 100 connections to your database. 10
cluster members means 1000 simultaneous connections.

 I had a bug in my code  and I was not closing connection, I fixed
 it and now this is working fine.

You should enable abandoned detection and logging.

 an architectural comment: it's probably not a great idea to 
 obtain a database connection directly from your Servlet. Doing
 so likely ties your business logic directly to both the servlet
 API *and* the JDBC API.
 
 If you want to switch to some other data source (e.g. a 
 non-JDBC-supported data source like MongoDB, Cassandra, etc.),
 then you have to re-write your whole app. If you want to support
 Websocket, then you have to completely re-write your webapp. If
 you want to create an Android or Swing-based version, you have to
 completely re-write your app. See the pattern here?
 
 
 I know existing design is somewhat a kind of limitation,but again
 at this point ,its just to hard to implement this change.
 
 Let me think over this.It will take sometime.

There's no time like the present: this problem will only get worse
over time.

- -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/

iEYEARECAAYFAk/rISAACgkQ9CaO5/Lv0PC8MwCeMVv+gx6x4ItxZspgJwI0e2km
458An0CPoRxJQBmh/AKRQFo4o64ByJZE
=eQp9
-END PGP SIGNATURE-

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



Re: Tomcat DBCP Connection pool issue

2012-06-26 Thread Steven Sinclair
在 2012-6-26,13:11,Kiran Badi ki...@poonam.org 写道:

 Hi All,
 
 While testing the pagination links ,I am getting below error,
 
 SEVERE: null
 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool 
 error Timeout waiting for idle object
at 
 org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
at 
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at indianads.getServicesTourDetail.doGet(getServicesTourDetail.java:106)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at 
 org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 Was able to get connection
at 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at 
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at 
 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at 
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at 
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at 
 org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
 Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at 
 org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1144)
at 
 org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
... 24 more
 
 Where should I look to see as how many connection are establised on the DB 
 side and how many I have still that I can use ?
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 

You can use java jmx console to monitor the number of db connections.

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



Re: Tomcat DBCP Connection pool issue

2012-06-26 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kiran,

On 6/26/12 1:11 AM, Kiran Badi wrote:
 While testing the pagination links ,I am getting below error,
 
 SEVERE: null org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
 get a connection, pool error Timeout waiting for idle object

Probably waited too long for a connection. What does your pool
configuration look like? Look in META-INF/context.xml or, I suppose,
in conf/server.xml for Resource elements.

 at 
 org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)

  at 
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)

  at 
 indianads.getServicesTourDetail.doGet(getServicesTourDetail.java:106)

Just
 
an architectural comment: it's probably not a great idea to
obtain a database connection directly from your Servlet. Doing so
likely ties your business logic directly to both the servlet API *and*
the JDBC API.

If you want to switch to some other data source (e.g. a
non-JDBC-supported data source like MongoDB, Cassandra, etc.), then
you have to re-write your whole app. If you want to support Websocket,
then you have to completely re-write your webapp. If you want to
create an Android or Swing-based version, you have to completely
re-write your app. See the pattern here?

- -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/

iEYEARECAAYFAk/qFD4ACgkQ9CaO5/Lv0PBh0QCgiXqoY7K4LhV2nKqlmTbG5bri
VPAAnjdS/a7ZF8CAoJ85VE+AoXMmDQ1q
=73J6
-END PGP SIGNATURE-

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



Re: Tomcat DBCP Connection pool issue

2012-06-26 Thread Kiran Badi
On 6/26/2012 12:09 PM, Steven Sinclair wrote:
 You can use java jmx console to monitor the number of db connections.
Thanks Steven, I will check this.Actually servlet was leaking connection
and I had forgot to close connection.Fixed it now.

But I still need to monitor DB side.I will check jmx console.


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



Re: Tomcat DBCP Connection pool issue

2012-06-26 Thread Kiran Badi
Probably waited too long for a connection. What does your pool 
configuration look like? Look in META-INF/context.xml or, I suppose, in 
conf/server.xml for Resource elements.


 Resource name=jdbc/mysitedb auth=Container 
type=javax.sql.DataSource

   maxActive=100 maxIdle=30 maxWait=1
   username=user password=xxx 
driverClassName=com.mysql.jdbc.Driver

   url=jdbc:mysql://localhost:3306/mysitedb/

This is my configuration in context.xml Chris.

 I had a bug in my code  and I was not closing connection, I fixed it 
and now this is working fine.

an architectural comment: it's probably not a great idea to
obtain a database connection directly from your Servlet. Doing so
likely ties your business logic directly to both the servlet API *and*
the JDBC API.

If you want to switch to some other data source (e.g. a
non-JDBC-supported data source like MongoDB, Cassandra, etc.), then
you have to re-write your whole app. If you want to support Websocket,
then you have to completely re-write your webapp. If you want to
create an Android or Swing-based version, you have to completely
re-write your app. See the pattern here?


I know existing design is somewhat a kind of limitation,but again at 
this point ,its just to hard to implement this change.


Let me think over this.It will take sometime.

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



Tomcat DBCP Connection pool issue

2012-06-25 Thread Kiran Badi

Hi All,

While testing the pagination links ,I am getting below error,

SEVERE: null
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, 
pool error Timeout waiting for idle object
at 
org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at 
indianads.getServicesTourDetail.doGet(getServicesTourDetail.java:106)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

Was able to get connection
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at 
org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1144)
at 
org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)

... 24 more

Where should I look to see as how many connection are establised on the 
DB side and how many I have still that I can use ?


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



Re: tomcat dbcp encryption

2012-03-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ognjen,

On 3/27/12 6:32 AM, Ognjen Blagojevic wrote:
 이재만,
 
 On 27.3.2012 9:54, 이재만 wrote:
 how do i encrypt my datasource's user and password  in server.xml
 ??
 
 Read this: http://wiki.apache.org/tomcat/FAQ/Password

No, he didn't like that answer last time, so he asked again :(

The answer, of course, is to use ZIP encryption or PGP/GPG. Good luck
starting Tomcat after that, though.

- -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/

iEYEARECAAYFAk9zO2UACgkQ9CaO5/Lv0PDj0gCfY3mSJV/VYzhjk226RPeo617Q
aGEAn2zXTsQayySY6txyRC16m9UOS2Id
=+Tna
-END PGP SIGNATURE-

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



RE: tomcat dbcp encryption

2012-03-28 Thread Filip Hanik (mailing lists)
Or pay a vendor to do it for you :)
http://pubs.vmware.com/vfabric5/index.jsp?topic=/com.vmware.vfabric.tc-server.2.6/admin/manual-encrypt-passwords.html



 -Original Message-
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Sent: Wednesday, March 28, 2012 10:25 AM
 To: Tomcat Users List
 Subject: Re: tomcat dbcp encryption
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Ognjen,
 
 On 3/27/12 6:32 AM, Ognjen Blagojevic wrote:
  이재만,
 
  On 27.3.2012 9:54, 이재만 wrote:
  how do i encrypt my datasource's user and password  in server.xml
  ??
 
  Read this: http://wiki.apache.org/tomcat/FAQ/Password
 
 No, he didn't like that answer last time, so he asked again :(
 
 The answer, of course, is to use ZIP encryption or PGP/GPG. Good luck
 starting Tomcat after that, though.
 
 - -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/
 
 iEYEARECAAYFAk9zO2UACgkQ9CaO5/Lv0PDj0gCfY3mSJV/VYzhjk226RPeo617
 Q
 aGEAn2zXTsQayySY6txyRC16m9UOS2Id
 =+Tna
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



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



Re: tomcat dbcp encrption

2012-03-27 Thread Mark Thomas
On 27/03/2012 08:53, 이재만 wrote:
 hello everybody...
 
 somebody help me..please..
 
 how do i encrypt my datasource's user and password  in server.xml ??

http://wiki.apache.org/tomcat/FAQ/Password

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



Re: tomcat dbcp encryption

2012-03-27 Thread Ognjen Blagojevic

이재만,

On 27.3.2012 9:54, 이재만 wrote:

how do i encrypt my datasource's user and password  in server.xml ??


Read this: http://wiki.apache.org/tomcat/FAQ/Password

-Ognjen


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



Re: Source jar for tomcat-dbcp?

2012-03-11 Thread Pid
On 11/03/2012 02:08, Jim Garrison wrote:
 -Original Message-
 From: Jim Garrison [mailto:jim.garri...@troux.com]
 Sent: Saturday, March 10, 2012 7:07 PM
 To: users@tomcat.apache.org
 Subject: Source jar for tomcat-dbcp?

 I have a problem I need to debug by stepping into tomcat-dbcp (6.0.35). I
 tried downloading the Apache commons-dbcp source but it seems the
 version in Tomcat has the classes in different packages, so I can't get 
 Eclipse
 to recognize the source.
 [snip]
 
 I think I've figured this out.  In build.xml, the commons-dbcp sources are 
 copied into a different package hierarchy and then built.  
 
 Based on build.properties.default I see that it uses commons-dbcp version 1.3 
 and commons-pool version 1.5.6.
 
 So all I need to do is duplicate what build.xml does to assemble the sources 
 in the proper locations.
 
 It would have been nice if this was noted in the docs :-)

Sounds like you're pretty close to being able to make a patch.  ;)


p

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


-- 

[key:62590808]



signature.asc
Description: OpenPGP digital signature


RE: Source jar for tomcat-dbcp?

2012-03-11 Thread Jim Garrison
  It would have been nice if this was noted in the docs :-)
 
 Sounds like you're pretty close to being able to make a patch.  ;)

I'm willing to write something up, but am not sure how to contribute it to the
doc website.  I rummaged through the ASF svn and found the tomcat/site
stuff, but it seems to be old and does not look like the current doc website.


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



Re: Source jar for tomcat-dbcp?

2012-03-11 Thread Pid
On 11/03/2012 21:41, Jim Garrison wrote:
 It would have been nice if this was noted in the docs :-)

 Sounds like you're pretty close to being able to make a patch.  ;)
 
 I'm willing to write something up, but am not sure how to contribute it to the
 doc website.  I rummaged through the ASF svn and found the tomcat/site
 stuff, but it seems to be old and does not look like the current doc website.

The website is in tomcat/site, the docs are in version specific dirs,
e.g. http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/webapps/docs


p

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


-- 

[key:62590808]



signature.asc
Description: OpenPGP digital signature


Source jar for tomcat-dbcp?

2012-03-10 Thread Jim Garrison
I have a problem I need to debug by stepping into tomcat-dbcp (6.0.35). I tried 
downloading the Apache commons-dbcp source but it seems the version in Tomcat 
has the classes in different packages, so I can't get Eclipse to recognize the 
source.

I've searched the following areas:

*  the tomcat source zip (apache-tomcat-6.0.35-src.zip) -- it does not contain 
the dbcp source
*  archive.apache.org/dist/tomcat/tomcat-6
*  maven-central; it has source jars for tomcat 7, but none for tomcat 6.
* svn.apache.org/repos/asf/tomcat/tc6.0.x/tags/TOMCAT_6_0_35/java -- this does 
not contain the dbcp sources either
* svn.apache.org/repos/asf/tomcat/tags/JDBC_POOL_1_1_0_1/ -- This looked 
promising, but on examination it does not seem to contain the source for the 
library in 6.0.35

The tomcat-dbcp.jar that came with 6.0.35 contains the following packages:

   org.apache.tomcat.dbcp.collections
   org.apache.tomcat.dbcp.dbcp
   org.apache.tomcat.dbcp.dbcp.cpdsadapter
   org.apache.tomcat.dbcp.datasources
   org.apache.tomcat.dbcp.jocl
   org.apache.tomcat.dbcp.pool
   org.apache.tomcat.dbcp.pool.impl

So, where can I find the source for tomcat-dbcp 6.0.35?


RE: Source jar for tomcat-dbcp?

2012-03-10 Thread Jim Garrison
 -Original Message-
 From: Jim Garrison [mailto:jim.garri...@troux.com]
 Sent: Saturday, March 10, 2012 7:07 PM
 To: users@tomcat.apache.org
 Subject: Source jar for tomcat-dbcp?
 
 I have a problem I need to debug by stepping into tomcat-dbcp (6.0.35). I
 tried downloading the Apache commons-dbcp source but it seems the
 version in Tomcat has the classes in different packages, so I can't get 
 Eclipse
 to recognize the source.
[snip]

I think I've figured this out.  In build.xml, the commons-dbcp sources are 
copied into a different package hierarchy and then built.  

Based on build.properties.default I see that it uses commons-dbcp version 1.3 
and commons-pool version 1.5.6.

So all I need to do is duplicate what build.xml does to assemble the sources in 
the proper locations.

It would have been nice if this was noted in the docs :-)

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



tomcat-dbcp interceptors

2011-11-11 Thread Stevo Slavić
Hello Tomcat users,

I have couple of tomcat-dbcp related questions:

1) Can tomcat-dbcp be used outside of tomcat e.g. in non-web apps?
2) If yes, are all features available as when used within tomcat?
3) Most importantly are custom interceptors supported when tomcat-dbcp
is used outside tomcat?
4) Can custom interceptor influence/extend connection validation?
Would like not only to configure validation query but also to add
extra logic which would process result of the query.
5) Are there any examples, documentation, blog posts showing
implementations of custom interceptors?

Thanks in advance!

Regards,
Stevo.

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



Re: tomcat-dbcp interceptors

2011-11-11 Thread Daniel Mikusa


 1) Can tomcat-dbcp be used outside of tomcat e.g. in non-web apps?

Yes, but tomcat-dbcp is exactly the same as commons-dbcp.  You would
probably just want to use commons-dbcp.

 2) If yes, are all features available as when used within tomcat?

It has the same feature set as commons-dbcp.

  https://commons.apache.org/dbcp/

 3) Most importantly are custom interceptors supported when tomcat-dbcp
 is used outside tomcat?
 4) Can custom interceptor influence/extend connection validation?
 Would like not only to configure validation query but also to add
 extra logic which would process result of the query.
 5) Are there any examples, documentation, blog posts showing
 implementations of custom interceptors?

I'm not exactly sure what you are referring to with regard to the
interceptors.  Which version of Tomcat are you using?  How are you
configuring this within Tomcat?

Dan




Re: tomcat-dbcp interceptors

2011-11-11 Thread Stevo Slavić
Hello Daniel,

You're right, commons-dbcp and tomcat-dbcp seem to be same, I missed
tomcat-jdbc module which seems to provide extensions and judging by
the pom (see [1]) it depends only on tomcat-juli. I found the answers
at [2] and [3].

Thanks!

Regards,
Stevo.

[1] 
http://repo1.maven.org/maven2/org/apache/tomcat/tomcat-jdbc/7.0.22/tomcat-jdbc-7.0.22.pom
[2] http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html
[3] 
http://vigilbose.blogspot.com/2009/03/apache-commons-dbcp-and-tomcat-jdbc.html


On Fri, Nov 11, 2011 at 2:35 PM, Daniel Mikusa dmik...@vmware.com wrote:


 1) Can tomcat-dbcp be used outside of tomcat e.g. in non-web apps?

 Yes, but tomcat-dbcp is exactly the same as commons-dbcp.  You would
 probably just want to use commons-dbcp.

 2) If yes, are all features available as when used within tomcat?

 It has the same feature set as commons-dbcp.

  https://commons.apache.org/dbcp/

 3) Most importantly are custom interceptors supported when tomcat-dbcp
 is used outside tomcat?
 4) Can custom interceptor influence/extend connection validation?
 Would like not only to configure validation query but also to add
 extra logic which would process result of the query.
 5) Are there any examples, documentation, blog posts showing
 implementations of custom interceptors?

 I'm not exactly sure what you are referring to with regard to the
 interceptors.  Which version of Tomcat are you using?  How are you
 configuring this within Tomcat?

 Dan




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



Re: Tomcat DBCP

2010-07-01 Thread Bill Davidson

On 6/9/2010 2:15 AM, Altanis Alexandros wrote:
I have been reading about the new Tomcat DBCP in a couple of blogs
lately, as I am interested in Connection Pooling for an application I am
working on. Here they are:

http://vigilbose.blogspot.com/2009/03/apache-commons-dbcp-and-tomcat-jdbc.html
http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency
http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html

(I'm a little behind on the list, and trying to catch up)

Interesting.  I was not aware of this other connection pool for Tomcat.
I'd be very interested in finding something faster than DBCP, which I
have found disappointing (I've got a lot of concurrency going on my
servers).

Based upon those links, it appears that you have to get the SpringSource
tc server to get the pool?  Is this is a SpringSource commercial (not free)
product?  That would explain why I don't see any mention of it in the
regular Tomcat docs.

As near as I can figure, it isn't part of the Apache Foundation site.  That
last link makes it look like it's part of Tomcat 7, but from what I can 
tell,

it is not.

If it is available free, then what is the appropriate method of getting 
it?  If

we don't want to buy SpringSource tc, do we need to check it out from
SVN and build it?  I can't find a normal home page for it.



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



Re: Tomcat DBCP

2010-07-01 Thread Mark Thomas

On 01/07/2010 23:31, Bill Davidson wrote:

On 6/9/2010 2:15 AM, Altanis Alexandros wrote:
 I have been reading about the new Tomcat DBCP in a couple of blogs
 lately, as I am interested in Connection Pooling for an application I am
 working on. Here they are:
 
 http://vigilbose.blogspot.com/2009/03/apache-commons-dbcp-and-tomcat-jdbc.html
 
http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency
 http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html

(I'm a little behind on the list, and trying to catch up)

Interesting. I was not aware of this other connection pool for Tomcat.
I'd be very interested in finding something faster than DBCP, which I
have found disappointing (I've got a lot of concurrency going on my
servers).

Based upon those links, it appears that you have to get the SpringSource
tc server to get the pool? Is this is a SpringSource commercial (not free)
product? That would explain why I don't see any mention of it in the
regular Tomcat docs.

As near as I can figure, it isn't part of the Apache Foundation site. That
last link makes it look like it's part of Tomcat 7, but from what I can
tell,
it is not.

If it is available free, then what is the appropriate method of getting
it? If
we don't want to buy SpringSource tc, do we need to check it out from
SVN and build it? I can't find a normal home page for it.


It is an unreleased module in trunk. You have to build it from source.

Mark



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



RE: Tomcat DBCP

2010-07-01 Thread Caldarale, Charles R
 From: Bill Davidson [mailto:bill...@gmail.com]
 Subject: Re: Tomcat DBCP
 
 If we don't want to buy SpringSource tc, do we need to check 
 it out from SVN and build it?

Not sure what the official status of the package is right now, but you can get 
it here:

http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/
http://svn.apache.org/repos/asf/tomcat/trunk/modules/jdbc-pool/

You definitely do not have to pay for it.

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



RE: Tomcat DBCP

2010-06-10 Thread Altanis Alexandros
Thanks! 

However, when I try to checkout the repository, I get 

Repository moved permanently to
'/viewvc/tomcat/trunk/modules/jdbc-pool/';

I had to use 

http://svn.apache.org/repos/asf/tomcat/trunk/modules/jdbc-pool/

in order to checkout. 

Thanks again! 

Alexander

-Original Message-
From: Mark Thomas [mailto:ma...@apache.org] 
Sent: Wednesday, June 09, 2010 1:31 PM
To: Tomcat Users List
Subject: Re: Tomcat DBCP

On 09/06/2010 10:15, Altanis Alexandros wrote:
 My question is this: can I use this feature with Tomcat 6?

Yes.

 Where can I get a hold of the source code? I found some svn
 links that point to 404. 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/

Mark




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



Re: Tomcat DBCP

2010-06-10 Thread Mark Thomas
On 10/06/2010 08:25, Altanis Alexandros wrote:
 Thanks! 
 
 However, when I try to checkout the repository, I get 
 
 Repository moved permanently to
 '/viewvc/tomcat/trunk/modules/jdbc-pool/';
 
 I had to use 
 
 http://svn.apache.org/repos/asf/tomcat/trunk/modules/jdbc-pool/
 
 in order to checkout. 
 
 Thanks again!

Sorry. My bad. I gave you the url for the viewer not the actual svn
checkout. The url you are using is the correct one.

Mark


 
 Alexander
 
 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org] 
 Sent: Wednesday, June 09, 2010 1:31 PM
 To: Tomcat Users List
 Subject: Re: Tomcat DBCP
 
 On 09/06/2010 10:15, Altanis Alexandros wrote:
 My question is this: can I use this feature with Tomcat 6?
 
 Yes.
 
 Where can I get a hold of the source code? I found some svn
 links that point to 404. 
 http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/
 
 Mark
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 




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



Tomcat DBCP

2010-06-09 Thread Altanis Alexandros
Hello. 

 

I have been reading about the new Tomcat DBCP in a couple of blogs
lately, as I am interested in Connection Pooling for an application I am
working on. Here they are: 

 

http://vigilbose.blogspot.com/2009/03/apache-commons-dbcp-and-tomcat-jdb
c.html

 

http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-c
oncurrency

 

After searching high and low for this in the Tomcat sources, to make a
long story short, I discovered that this is a planned Tomcat 7 feature: 

 

http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html

 

:-\ 

 

My question is this: can I use this feature with Tomcat 6? Hash anyone
tried it? Where can I get a hold of the source code? I found some svn
links that point to 404. 

 

Thanks in advance

Alexander Altanis



Re: Tomcat DBCP

2010-06-09 Thread Mark Thomas
On 09/06/2010 10:15, Altanis Alexandros wrote:
 My question is this: can I use this feature with Tomcat 6?

Yes.

 Where can I get a hold of the source code? I found some svn
 links that point to 404. 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/

Mark



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



Tomcat DBCP : testOnBorrow not working (?)

2010-03-10 Thread José Paumard

Hello all,

Here is my problem. I have a very classical configuration where a webapp 
with some Hibernate code in it accesses a MySQL DB. Everything is 
installed in Tomcat 6.


After some time, Hibernate complains about dropped connections, the 
error message looks like this :
com.mysql.jdbc.CommunicationsException : Communications link failure The 
last packet successfully received from the server was 204 734 
milliseconds ago. The last packet sent successfully to the server was 0 
milliseconds ago.
java.io.EOFException : Can not read response from server. Expected to 
read 4 bytes, read 0 bytes before connection was unexpectedly lost.


Refeshing the page once or twice usually fixes the problem.

I could narrow the problem and reproduce it on demand, juste by setting 
the wait timeout parameter of MySQL to a very low value : 10s (the 
default value is 8 hours). If I use my webapp fast enough (less than 10s 
between clicks) everything runs fine. If I wait just 12s, this problem 
shows up, 100% of the time. Reloading the page once or twice fixes it.


So my guess here is that Hibernate is provided with a closed connection 
(please correct me if you think I'm wrong on that point). Setting 
autoReconnect=true on the connection string doesnt help (I red somewhere 
that it was not expected to help in the case of MySQL for some reason, 
so I guess it's normal).


The configuration is the following : the datasource is configured in a 
context.xml file in the META-INF dir of the webapp.

 Resource name=jdbc/myds auth=Container type=javax.sql.DataSource
   maxActive=20 maxIdle=10 maxWait=3
   username=*** password=*** 
driverClassName=com.mysql.jdbc.Driver
   
url=jdbc:mysql://localhost/mydb?useUnicode=truecharacterEncoding=utf8/


Then the webapp uses it through a declaration in a persistence.xml file 
(JPA standard file).


   persistence-unit name=MyDataService
   providerorg.hibernate.ejb.HibernatePersistence/provider
   non-jta-data-sourcejava:/comp/env/jdbc/myds/non-jta-data-source
   !-- JPA stuff removed --
   /persistence-unit

To be sure that DBCP is not providing closed connections to Hibernate, I 
added the following to the Resource element, but with no success :

 Resource name=jdbc/myds auth=Container type=javax.sql.DataSource
   maxActive=20 maxIdle=10 maxWait=3
   username=*** password=*** 
driverClassName=com.mysql.jdbc.Driver
   
url=jdbc:mysql://localhost/mydb?useUnicode=truecharacterEncoding=utf8

   validationQuery=select 1 testOnBorrow=true/

From what I understand in the DBCP docs :
- the validation query has to be set to some legal value for DBCP to 
test the connection, which is the case

- testOnBorrow is true by default, setting it again cant harm can it ?

I tried to tune timeBetweenEvictionRunsMillis, numTestsPerEvictionRun 
and minEvictableIdleTimeMillis with testWhileIdle set to true, but with 
no more success.


Any hint would be much appreciated, especially on the logging side 
(Tomcat / DBCP), since I cant see how to get more information on what is 
going on with those buggy connections.


Thank you,

José




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



Re: Tomcat DBCP : testOnBorrow not working (?)

2010-03-10 Thread Konstantin Kolinko
2010/3/10 José Paumard jose.paum...@orange.fr:
 To be sure that DBCP is not providing closed connections to Hibernate, I
 added the following to the Resource element, but with no success : (...)

Note, that META-INF/context.xml of a web application is copied to
${catalina.base}/conf/Catalina/localhost/yourappname.xml
when your application is deployed on Tomcat.

(the path will be different if you have different Service and Host
names. The above ones are the defaults).

Look there and make sure that your updates to context.xml were picked
up by Tomcat.

Best regards,
Konstantin Kolinko

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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yagnesh,

On 11/18/2009 1:32 AM, Yagnesh Chawda wrote:
   There is no difference in the outcome when I use com.mysql.jdbc.Driver
 
max_connections=200 is still same in MySQL.

That is very strange.

Can you try to configure the data source through Tomcat (that is, using
a Resource element in your context.xml file) to see if it's the
connection pool or if Spring is doing something behind the scenes?

You could just code-up a simple JSP that does some database access using
the DataSource that Tomcat configures and run a simple JMeter test
against that. Don't bother deploying your own webapp because it will
just make things more confusing.

It's possible that Spring is doing something strange, here.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksEGuQACgkQ9CaO5/Lv0PDvHgCfTKIs4e7FUzslV+H86RElPE43
2i0AoKRwThEAY2gIuzEpVZ8NrLKFSLbA
=BKur
-END PGP SIGNATURE-

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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-17 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yagnesh,

On 11/17/2009 12:32 AM, Yagnesh Chawda wrote:
  Thanks Chris, That was just a typo. Thanks for pointing it out. But in real
 configuration was was not commented. It was some other config which I was
 trying and forgot to uncomment it in posting.

Ok.

 bean id=dataSource destroy-method=close
   class=org.apache.commons.dbcp.BasicDataSource
   property name=driverClassName
value=com.mysql.jdbc.jdbc2.optional.MysqlDataSource/
   property name=url value=${db.url}/
   property name=username value=${db.user}/
   property name=password value=${db.pass}/
   property name=initialSize value=40/
   property name=minIdle value=35/
   property name=maxActive value=95/
   property name=maxWait value=2/
   /bean

I find it unusual that you'd be using a DataSource as the driver class
name. Typically, for MySQL, you'd use com.mysql.jdbc.Driver as the class
name, not the MySQL-supplied DataSource as the driver class name.

Other than that, I would expect your connection pool to always have a
minimum of 35 connections sitting idle in it, even when your site was
seeing no traffic.

I wonder if the problem is that you appear to be using two data sources
instead of one data source and one JDBC driver.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksCvlgACgkQ9CaO5/Lv0PCNRQCgwqSmsc1EUj7aCxh1hGhGjImC
7IIAnjC4PQCrSepnOuMUvAcAIAQy8Kia
=8Fl9
-END PGP SIGNATURE-

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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-17 Thread Yagnesh Chawda

Hi Chris,
  Thanks for reply. I had tried using com.mysql.jdbc.Driver as well
earlier. But no luck :(



Christopher Schultz-2 wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Yagnesh,
 
 On 11/17/2009 12:32 AM, Yagnesh Chawda wrote:
  Thanks Chris, That was just a typo. Thanks for pointing it out. But in
 real
 configuration was was not commented. It was some other config which I was
 trying and forgot to uncomment it in posting.
 
 Ok.
 
 bean id=dataSource destroy-method=close
   class=org.apache.commons.dbcp.BasicDataSource
  property name=driverClassName
value=com.mysql.jdbc.jdbc2.optional.MysqlDataSource/
  property name=url value=${db.url}/
  property name=username value=${db.user}/
  property name=password value=${db.pass}/
  property name=initialSize value=40/
  property name=minIdle value=35/
  property name=maxActive value=95/
  property name=maxWait value=2/
  /bean
 
 I find it unusual that you'd be using a DataSource as the driver class
 name. Typically, for MySQL, you'd use com.mysql.jdbc.Driver as the class
 name, not the MySQL-supplied DataSource as the driver class name.
 
 Other than that, I would expect your connection pool to always have a
 minimum of 35 connections sitting idle in it, even when your site was
 seeing no traffic.
 
 I wonder if the problem is that you appear to be using two data sources
 instead of one data source and one JDBC driver.
 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAksCvlgACgkQ9CaO5/Lv0PCNRQCgwqSmsc1EUj7aCxh1hGhGjImC
 7IIAnjC4PQCrSepnOuMUvAcAIAQy8Kia
 =8Fl9
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Tomcat-DBCP-Connection-Pooling-to-MySQL-limited-number-of-connection-issue-in-Spring2.5-%2B-Hibernate3-%2B-commons-DBCP1.2-tp26372475p26392261.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-17 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yagnesh,

On 11/17/2009 10:51 AM, Yagnesh Chawda wrote:
   Thanks for reply. I had tried using com.mysql.jdbc.Driver as well
 earlier. But no luck :(

What does happen when you use com.mysql.jdbc.Driver?

What are the current values for max_connections and max_user_connections
in MySQL? I know you said you set max_connections=200 but I just wanted
to make sure that MySQL actually has that setting while it's running.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksDG/IACgkQ9CaO5/Lv0PBc0wCgq7YxJdaIHiCbiKUTwngX99QI
gqoAoL9T9Yw4WR4NXF8gDbC/F6KyDZ1F
=YvGV
-END PGP SIGNATURE-

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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-17 Thread Yagnesh Chawda

Hi,
  There is no difference in the outcome when I use com.mysql.jdbc.Driver

   max_connections=200 is still same in MySQL. I confirmed that MySQL is
able to handle that much load by running JMeter load testing which causes my
application to create even 95 connection if I set maxActive connections in
my pool  = 95. BUt problem is that with each HTTP request from JMeter, if
pool is creating new connection to MySQL as only 8-9 connections are
available in pool. And pool drops connection immediately after serving that
request.
  I hope that I have told you that, pool attempts to create initialSize
number of connections to the MySQL server. But it also drops it off
immediately in a second or two, leaving behind only 8-9 pooled connection.



Christopher Schultz-2 wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Yagnesh,
 
 On 11/17/2009 10:51 AM, Yagnesh Chawda wrote:
   Thanks for reply. I had tried using com.mysql.jdbc.Driver as well
 earlier. But no luck :(
 
 What does happen when you use com.mysql.jdbc.Driver?
 
 What are the current values for max_connections and max_user_connections
 in MySQL? I know you said you set max_connections=200 but I just wanted
 to make sure that MySQL actually has that setting while it's running.
 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAksDG/IACgkQ9CaO5/Lv0PBc0wCgq7YxJdaIHiCbiKUTwngX99QI
 gqoAoL9T9Yw4WR4NXF8gDbC/F6KyDZ1F
 =YvGV
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Tomcat-DBCP-Connection-Pooling-to-MySQL-limited-number-of-connection-issue-in-Spring2.5-%2B-Hibernate3-%2B-commons-DBCP1.2-tp26372475p26402989.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-16 Thread Yagnesh Chawda

Hi,
  I am using Spring 2.5, Hibernate 3 and MySQL (5.0.45 (32 Bit), 5.0.84(64
Bit)) with commons-DBCP 1.2 in Tomcat-5.5

My issue is that even after specifying Connection pool of initialSize=40
and minIdle=35, my App. server is never keep only 9 connections open under
zero load condition. What I could figure out from the MySQL log was that,
server did created 40 connections, but also dropped each connection in 1-2
seconds after connection started. I have max_connection=200 in MySQL, and
time to keep idle connection in MySQL is also 8Hrs. 
  
Under load, App server creates connections upto 95 as I have described
it as maxActive=95
I confirmed it thru show global status and show processlist on MySQL
prompt while simulating a heavy traffic thru JMeter.

I tried with c3p0 from Hibernate, but no luck. Outcome is exactly same.
So am wondering what the issue is ??

 My bean definition is as follows for DBCP:


bean id=dataSource destroy-method=close
class=org.apache.commons.dbcp.BasicDataSource
!--property name=driverClassName
value=com.mysql.jdbc.jdbc2.optional.MysqlDataSource/
property name=url value=${db.url}/
property name=username value=${db.user}/
property name=password value=${db.pass}/
property name=initialSize value=40/
property name=minIdle value=35/
property name=maxActive value=95/
property name=maxWait value=2/ --
/bean



!-- Hibernate related Beans definition starts here --
bean  id=sessionFactory
  
class=org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
   property name=dataSource ref=dataSource /


   property name=annotatedClasses
   list
 valuecom.domain.Company/value
 valuecom.domain.Country/value
   /list
   /property
   property name=hibernateProperties
props
prop key=hibernate.show_sqlfalse/prop
prop key=hibernate.format_sqlfalse/prop
prop 
key=hibernate.dialectorg.hibernate.dialect.MySQLDialect/prop
prop
key=hibernate.transaction.factory_classorg.hibernate.transaction.JDBCTransactionFactory/prop

prop
key=hibernate.cache.provider_classorg.hibernate.cache.EhCacheProvider/prop
prop
key=hibernate.cache.provider_configuration_file_resource_pathmy-ehcache.xml/prop
prop 
key=hibernate.cache.use_structured_entriestrue/prop
prop 
key=hibernate.cache.use_second_level_cachetrue/prop
prop key=hibernate.cache.use_query_cachetrue/prop
prop key=hibernate.default_batch_fetch_size30/prop
prop key=hibernate.jdbc.batch_size30/prop
prop key=hibernate.generate_statisticstrue/prop
prop key=hibernate.order_updatestrue/prop
prop 
key=hibernate.connection.release_modeauto/prop
/props
   /property
/bean

-- 
View this message in context: 
http://old.nabble.com/Tomcat-DBCP-Connection-Pooling-to-MySQL-limited-number-of-connection-issue-in-Spring2.5-%2B-Hibernate3-%2B-commons-DBCP1.2-tp26372475p26372475.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-16 Thread Evan Siegel
UNSUBSCRIBE ME!
I have been emailing you guys for over a week to unsubcribe me. PLEASE CEASE 
AND DESIST FROM SENDING ME MORE MAILINGS FROM THIS LIST!

 
font color=redPlease visit our websites at/font
http://www.geocities.com/evan_j_siegel'http://www.geocities.com/evan_j_siegel;http://www.geocities.com/evan_j_siegel
and
http://www.qlineorientalist.com/IranRises'http://www.qlineorientalist.com/IranRises;http://www.qlineorientalist.com/IranRises
Thank you.





From: Yagnesh Chawda yagnesh.cha...@gmail.com
To: users@tomcat.apache.org
Sent: Mon, November 16, 2009 9:09:51 AM
Subject: Tomcat DBCP Connection Pooling to MySQL limited number of connection 
issue in Spring2.5 + Hibernate3 + commons-DBCP1.2


Hi,
  I am using Spring 2.5, Hibernate 3 and MySQL (5.0.45 (32 Bit), 5.0.84(64
Bit)) with commons-DBCP 1.2 in Tomcat-5.5

My issue is that even after specifying Connection pool of initialSize=40
and minIdle=35, my App. server is never keep only 9 connections open under
zero load condition. What I could figure out from the MySQL log was that,
server did created 40 connections, but also dropped each connection in 1-2
seconds after connection started. I have max_connection=200 in MySQL, and
time to keep idle connection in MySQL is also 8Hrs. 
  
Under load, App server creates connections upto 95 as I have described
it as maxActive=95
I confirmed it thru show global status and show processlist on MySQL
prompt while simulating a heavy traffic thru JMeter.

I tried with c3p0 from Hibernate, but no luck. Outcome is exactly same.
So am wondering what the issue is ??

My bean definition is as follows for DBCP:


bean id=dataSource destroy-method=close
class=org.apache.commons.dbcp.BasicDataSource
!--property name=driverClassName
value=com.mysql.jdbc.jdbc2.optional.MysqlDataSource/
property name=url value=${db.url}/
property name=username value=${db.user}/
property name=password value=${db.pass}/
property name=initialSize value=40/
property name=minIdle value=35/
property name=maxActive value=95/
property name=maxWait value=2/ --
/bean



!-- Hibernate related Beans definition starts here --
bean  id=sessionFactory
  
class=org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
   property name=dataSource ref=dataSource /


   property name=annotatedClasses
   list
 valuecom.domain.Company/value
 valuecom.domain.Country/value
   /list
   /property
   property name=hibernateProperties
props
prop key=hibernate.show_sqlfalse/prop
prop key=hibernate.format_sqlfalse/prop
prop 
key=hibernate.dialectorg.hibernate.dialect.MySQLDialect/prop
prop
key=hibernate.transaction.factory_classorg.hibernate.transaction.JDBCTransactionFactory/prop

prop
key=hibernate.cache.provider_classorg.hibernate.cache.EhCacheProvider/prop
prop
key=hibernate.cache.provider_configuration_file_resource_pathmy-ehcache.xml/prop
prop key=hibernate.cache.use_structured_entriestrue/prop
prop key=hibernate.cache.use_second_level_cachetrue/prop
prop key=hibernate.cache.use_query_cachetrue/prop
prop key=hibernate.default_batch_fetch_size30/prop
prop key=hibernate.jdbc.batch_size30/prop
prop key=hibernate.generate_statisticstrue/prop
prop key=hibernate.order_updatestrue/prop
prop key=hibernate.connection.release_modeauto/prop
/props
   /property
/bean

-- 
View this message in context: 
http://old.nabble.com/Tomcat-DBCP-Connection-Pooling-to-MySQL-limited-number-of-connection-issue-in-Spring2.5-%2B-Hibernate3-%2B-commons-DBCP1.2-tp26372475p26372475.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


  

Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-16 Thread Pid

On 16/11/2009 14:12, Evan Siegel wrote:

UNSUBSCRIBE ME!
I have been emailing you guys for over a week to unsubcribe me.

 PLEASE CEASE AND DESIST FROM SENDING ME MORE MAILINGS FROM THIS LIST!

You guys?  There's only one email from you, that I can see to this 
list, which is this one.  So... ?


You managed to subscribe to the list, can't you follow the instructions 
on how to unsubscribe?  Clues at the bottom of every email.



p



font color=redPlease visit our websites at/font
http://www.geocities.com/evan_j_siegel'http://www.geocities.com/evan_j_siegel;http://www.geocities.com/evan_j_siegel
and
http://www.qlineorientalist.com/IranRises'http://www.qlineorientalist.com/IranRises;http://www.qlineorientalist.com/IranRises
Thank you.





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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-16 Thread Peter Crowther
2009/11/16 Pid p...@pidster.com:
 You managed to subscribe to the list, can't you follow the instructions on
 how to unsubscribe?  Clues at the bottom of every email.

We keep saying that, and it keeps being a problem for users.

The email-based unsubscribe appears to be unreliable, I suspect due to
an overzealous spam filter being applied to messages arriving at it.
I don't know whether it's possible to implement an alternative web
form-based approach that mails the user to confirm the unsubscribe,
but allows the user to paste a verify code into the unsubscribe page
so that they never have to email the Apache list server.

- Peter

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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-16 Thread Mark Thomas
Peter Crowther wrote:
 2009/11/16 Pid p...@pidster.com:
 You managed to subscribe to the list, can't you follow the instructions on
 how to unsubscribe?  Clues at the bottom of every email.
 
 We keep saying that, and it keeps being a problem for users.
 
 The email-based unsubscribe appears to be unreliable, I suspect due to
 an overzealous spam filter being applied to messages arriving at it.
 I don't know whether it's possible to implement an alternative web
 form-based approach that mails the user to confirm the unsubscribe,
 but allows the user to paste a verify code into the unsubscribe page
 so that they never have to email the Apache list server.

It is clear that Evan is sending e-mail in HTML. That is almost enough on it's
own to trigger the spam filter and most e-mails manage to trigger a couple more
rules to push the score over the threshold.

I thought that spam filtering on unsubscribe addresses had been disabled. I'll
check that and if it hasn't see what can be done in that direction.

I note that there has been zero communication from Evan to the list owner. I'll
also note that the time it takes one of the list owners to unsubscribe someone
who complains to the list tends to be directly proportional to the rudeness of
the message. Given the tone of Evan's message I don't feel any great urge to
help him any time soon.

Mark


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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yagnesh,

On 11/16/2009 9:09 AM, Yagnesh Chawda wrote:
  My bean definition is as follows for DBCP:
 
 bean id=dataSource destroy-method=close
 class=org.apache.commons.dbcp.BasicDataSource
   !--property name=driverClassName
 value=com.mysql.jdbc.jdbc2.optional.MysqlDataSource/
   property name=url value=${db.url}/
   property name=username value=${db.user}/
   property name=password value=${db.pass}/
   property name=initialSize value=40/
   property name=minIdle value=35/
   property name=maxActive value=95/
   property name=maxWait value=2/ --
   /bean

Your bean appears to be almost entirely commented-out. Is this your real
configuration?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksCE8cACgkQ9CaO5/Lv0PDaRQCfWQPncqd/ykRg9AD4M43ag8FJ
UKkAn0sSdb3b/pUDp9RDDV9KJG1noqys
=MAA7
-END PGP SIGNATURE-

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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-16 Thread Yagnesh Chawda

Hey,
 Thanks Chris, That was just a typo. Thanks for pointing it out. But in real
configuration was was not commented. It was some other config which I was
trying and forgot to uncomment it in posting.



Christopher Schultz-2 wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Yagnesh,
 
 On 11/16/2009 9:09 AM, Yagnesh Chawda wrote:
  My bean definition is as follows for DBCP:
 
 bean id=dataSource destroy-method=close
 class=org.apache.commons.dbcp.BasicDataSource
  !--property name=driverClassName
 value=com.mysql.jdbc.jdbc2.optional.MysqlDataSource/
  property name=url value=${db.url}/
  property name=username value=${db.user}/
  property name=password value=${db.pass}/
  property name=initialSize value=40/
  property name=minIdle value=35/
  property name=maxActive value=95/
  property name=maxWait value=2/ --
  /bean
 
 Your bean appears to be almost entirely commented-out. Is this your real
 configuration?
 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAksCE8cACgkQ9CaO5/Lv0PDaRQCfWQPncqd/ykRg9AD4M43ag8FJ
 UKkAn0sSdb3b/pUDp9RDDV9KJG1noqys
 =MAA7
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Tomcat-DBCP-Connection-Pooling-to-MySQL-limited-number-of-connection-issue-in-Spring2.5-%2B-Hibernate3-%2B-commons-DBCP1.2-tp26372475p26384679.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



Tomcat DBCP: Getting java.sql.SQLException: Closed Statement

2009-05-06 Thread ashoknan

We are getting below exception in production randomly..Using Spring(2.5) JDBC
for all our DB related functionality.We don't handle any DB resources
directly.everything thru Spring JDBC template. This app was running fine in
Weblogic but after migrating to Tomcat 6+ DBCP we are seeing the below
exception. 

We also looked our code base for any threading or concurrency issues..we
were not able spot any issues. 

I have observed one more thing..why checkOpen in DelegatingPreparedStatement
didn't catch this but OracleStatement thinks the statement is closed.

If anbody else faced this issue before please share your solutions. 


Caused by: org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO
AUDIT_TRAIL ( DEAL_ID , AUDIT_TRAIL_ID ) VALUES ( ?,? ) ]; SQL state [null];
error code [17009]; Closed Statement; nested exception is
java.sql.SQLException: Closed Statement 
at
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124)
 
at
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
 
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:607) 
at
org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:792) 
at
org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:815) 
at
org.springframework.jdbc.object.SqlUpdate.update(SqlUpdate.java:168) 
at
com.dao.DealXAuditTrailDaoBase.insertDealXAuditTrailVoBase(Unknown Source) 
at com.deal.DealTO.insertAuditTrail(DealTO.java:183) 
at com.deal.DealTO.processAuditTrail(DealTO.java:168) 
at com.deal.DealTO.update(DealTO.java:110) 
at com.deal.DealTO$$FastClassByCGLIB$$fba55fe6.invoke(generated) 
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) 
at
org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
 
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
 
at
com.businessrules.SpexBusinessRuleValidator.invoke(SpexBusinessRuleValidator.java:64)
 
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
 
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 
at
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
 
at com.deal.DealTO$$EnhancerByCGLIB$$54d9c9a4.update(generated) 
at
com.entity.EntityGeneralInfoController.copyFieldsToDeal(EntityGeneralInfoController.java:1158)
 
at
com.entity.EntityGeneralInfoController.doSave(EntityGeneralInfoController.java:429)
 
... 30 more 
Caused by: java.sql.SQLException: Closed Statement 
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) 
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162) 
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227) 
at
oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3249) 
at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2867)
 
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2957)
 
at
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
 
at
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
 
at
org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:798)
 
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591) 




Resource name=oracleDS auth=Container 
type=javax.sql.DataSource 
driverClassName=oracle.jdbc.OracleDriver 
url=jdbc:oracle:thin:@x:1521:x 
username= password= 
initialSize=2 maxActive=30 maxIdle=30
maxWait=3000 minIdle=0 
testOnBorrow=true testOnReturn=false
testWhileIdle=false 
poolPreparedStatements=true
maxOpenPreparedStatements=10 
removedAbandoned=true
removeAbandonedTimeout=60 
logAbandoned=true validationQuery=select
count(*) from dual/ 

-- 
View this message in context: 
http://www.nabble.com/Tomcat-DBCP%3A-Getting-java.sql.SQLException%3A

Re: Tomcat DBCP: Getting java.sql.SQLException: Closed Statement

2009-05-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ashoknan,

On 5/6/2009 5:43 PM, ashoknan wrote:
 This app was running fine in Weblogic but after migrating to Tomcat
 6+ DBCP we are seeing the below exception.

Which version of TC 6 are you using? Are you using the stock DBCP or
Filip's new-fangled DBCP?

 We also looked our code base for any threading or concurrency issues..we
 were not able spot any issues. 

Famous last words.

 I have observed one more thing..why checkOpen in DelegatingPreparedStatement
 didn't catch this but OracleStatement thinks the statement is closed.

What makes you say that DelegatingPreparedStatement.checkOpen is being
called and seeing an incorrect state?

I suspect you (or the Spring folks?) are unwrapping the pooled statement
at some point to expose its Oracle-ness, and then you are (incorrectly)
closing the underlying statement instead of closing the wrapping
(pooled) statement as you should be.

 org.springframework.jdbc.object.SqlUpdate.update(SqlUpdate.java:168) 
 at
 com.dao.DealXAuditTrailDaoBase.insertDealXAuditTrailVoBase(Unknown Source) 

This code (yours?) is calling SqlUpdate.update. What does your code look
like around here? Are you using any transactions?

 at com.deal.DealTO.insertAuditTrail(DealTO.java:183) 
 at com.deal.DealTO.processAuditTrail(DealTO.java:168) 
 at com.deal.DealTO.update(DealTO.java:110) 

The code around here might be useful to see, too.

 validationQuery=select count(*) from dual/ 

That's a weird one.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkoCRHkACgkQ9CaO5/Lv0PD01gCdH7IHL1q8iXbTmRp9HVyciRNi
wJQAnjvN+vEcyoW7TWOGnD0G04506cCO
=aFGJ
-END PGP SIGNATURE-

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



commons-dbcp and tomcat-dbcp

2007-11-15 Thread uma_rk


Env: Redhat, jre6, Tomcat 6.0.14

In migrating a webapp using commons-dbcp from Tomcat 5.5.x to Tomcat 6.0.x,
I find that my database fails to obtain connections from the pool.

This is a long shot: is there any interplay between tomcat-dbcp (located in
${CATALINA_BASE}/lib and commons-dbcp (situated in my webapp)?

Regards,

/U

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat-dbcp from Maven

2007-05-21 Thread Filip Hanik - Dev Lists
the maven jars/upload is still in process, if you want to contribute 
help, take a look at res/maven in the tomcat 6 tree


Filip

lightbulb432 wrote:

The tomcat-dbcp library doesn't seem to be available from the Maven
repository for Tomcat at http://tomcat.apache.org/dev/dist/m2-repository or
repo1.maven.org...am I just missing another maven repository that I should
be looking at, or must I manually install this JAR into my own local
repository?

Also, when will the latest version of the JARs (later than 6.0.10) be
uploaded to the repository at
http://tomcat.apache.org/dev/dist/m2-repository - what's the process for
deciding when it's appropriate to upload Tomcat releases to the Maven
repositories for Tomcat?

Thanks.
  



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



tomcat-dbcp from Maven

2007-05-19 Thread lightbulb432

The tomcat-dbcp library doesn't seem to be available from the Maven
repository for Tomcat at http://tomcat.apache.org/dev/dist/m2-repository or
repo1.maven.org...am I just missing another maven repository that I should
be looking at, or must I manually install this JAR into my own local
repository?

Also, when will the latest version of the JARs (later than 6.0.10) be
uploaded to the repository at
http://tomcat.apache.org/dev/dist/m2-repository - what's the process for
deciding when it's appropriate to upload Tomcat releases to the Maven
repositories for Tomcat?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/tomcat-dbcp-from-Maven-tf3782721.html#a10697671
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat / DBCP / Oracle / Reconnect

2007-01-18 Thread Krishna Paparaju
Hi all,
Need help on this. We are using Tomcat 5.5 with DBCP to reach
Oracle DB. When this DB goes down for an hour or so and comes back up
(like maintenance etc), Tomcat server is not able to connect back to DB
and the only way out is restarting the tomcat server.  

I am trying to find is there anyway Tomcat can be configured to
reconnect back to DB once it is up. I know autoReconnect flag works for
mySQL. Is there any equivalent in Oracle/thin driver?

Appreciate your help.


Krishna

-Original Message-
From: Nelson, Tracy M. [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 18, 2007 9:59 AM
To: Tomcat Users List
Subject: RE: Accessing files from file server

| From: Priya Khanna [mailto:[EMAIL PROTECTED]
| Sent: Thursday, 18 January, 2007 01:41
| 
| In my application my user will be logged in
| as domain user only so is it possible to check at run time that who
has
| logged in and if user has access on file server then he can access the
| files even if the tomcat is running as local user.

It may be possible to check the user's credentials via an LDAP
connection
(or whatever method is appropriate for your security/authorization
system).
However, it will not be possible to access the remote server directly
from
Tomcat (including any of your servlets or JSPs).  You might be able to
use
something like the Commons VFS (http://jakarta.apache.org/commons/vfs/).

| Second issue is that - If I want to upload the files then I want to
| check that user who is logged in to the application has write access
or
| not on file server. If not then he should get error message. My user
| will be logged in to application as same user id as his/her domain
user
| id. But I am not sure how to achieve this.

I'm not sure what the problem is here.  If the user doesn't have write
access to the server, you'll definitely get an error indication of some
sort.  All you have to do is decide how you want to present that to the
user.

-

The information contained in this message is confidential
proprietary property of Nelnet, Inc. and its affiliated 
companies (Nelnet) and is intended for the recipient only.
Any reproduction, forwarding, or copying without the express
permission of Nelnet is strictly prohibited. If you have
received this communication in error, please notify us
immediately by replying to this e-mail.



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat / DBCP / Oracle / Reconnect

2007-01-18 Thread Mark Thomas
When starting a new thread (ie sending a message to the list about a
new topic) please do not reply to an existing message and change the
subject line. To many of the list archiving services and mail clients
used by list subscribers this  makes your new message appear as part
of the old thread. This makes it harder for other users to find
relevant information when searching the lists.

This is known as thread hijacking and is behaviour that is frowned
upon on this list. Frequent offenders will be removed from the list.
It should also be noted that many list subscribers automatically
ignore any messages that hijack another thread.

The correct procedure is to create a new message with a new subject.
This will start a new thread.

Mark
tomcat-user-owner

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat / DBCP / Oracle / Reconnect

2007-01-18 Thread Krishna Paparaju
Hi all,

  Need help on this. We are using Tomcat 5.5 with DBCP to reach
Oracle DB. When this DB goes down for an hour or so and comes back up
(like maintenance etc), Tomcat server is not able to connect back to DB
and the only way out is restarting the tomcat server.  

 

I am trying to find is there anyway Tomcat can be configured to
reconnect back to DB once it is up. I know autoReconnect flag works for
mySQL. Is there any equivalent in Oracle/thin driver?

 

Appreciate your help.

 

 

Krishna

 

Krishna Prasad Paparaju| Senior Java Engineer, Global Application
Services (IT)

W.408.518.4341| M.408.332.3498|

 http://www.pillardata.com http://www.pillardata.com/ 

 



Re: Tomcat / DBCP / Oracle / Reconnect

2007-01-18 Thread Mark Thomas
Krishna Paparaju wrote:
 I am trying to find is there anyway Tomcat can be configured to
 reconnect back to DB once it is up. I know autoReconnect flag works for
 mySQL. Is there any equivalent in Oracle/thin driver?

You could use testOnBorrow=true and a validationQuery to achieve
this. Check the docs for DBCP for details on how to configure this.

Mark

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat / DBCP / Oracle / Reconnect

2007-01-18 Thread Krishna Paparaju
I could make this work with 'validationQuery' parameter. 

Thanks


-Original Message-
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 18, 2007 7:08 PM
To: Tomcat Users List
Subject: Re: Tomcat / DBCP / Oracle / Reconnect

Krishna Paparaju wrote:
 I am trying to find is there anyway Tomcat can be configured to
 reconnect back to DB once it is up. I know autoReconnect flag works
for
 mySQL. Is there any equivalent in Oracle/thin driver?

You could use testOnBorrow=true and a validationQuery to achieve
this. Check the docs for DBCP for details on how to configure this.

Mark

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Sharing Tomcat DBCP connection

2006-09-15 Thread Stanley Bradbury

Foo Shyn wrote:

Hi guys,

Currently i'm using Tomcat 4.1 and my application uses the Tomcat's DBCP to 
connect to a Derby database.

However, since the Derby database only allow one application to connect to it 
at a time, is it possible that i could configure the Tomcat's DBCP connection 
so that other application (not web application) can uses it as well?

Any ideas and hints are welcomed.

Thanx.
Regards,
FooShyn
  

Hi Foo Shyn -
This is a common misconception caused by all the cautions in the Derby 
documentation but, in your context, the warnings do not apply since you 
are working with a Client-Server architecture (Tomcat).  Derby is a 
multi threaded, multi user system that multiple deployed applications 
can safely use when it is embedded in a server architecture such as 
Tomcat. 

The key is to be sure that Derby is loaded by Tomcat in the same 
classloader as the DBCP classes (COMMON) then have all applications 
access Derby via DBCP datasources.  The Derby website has a paper that 
describes setting this up to run the JPetstore program.  The datasource 
created can be access by any program deployed to that server.  Here is 
the link to the Global Datasource setup instructions in the article: 


http://db.apache.org/derby/integrate/DerbyTomcat5512JPetStor.html#Setup+of+Application+with+the+Datasource+in+the+Global+Context%3A

Hope this helps.



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Sharing Tomcat DBCP connection

2006-09-14 Thread Mikolaj Rydzewski

Foo Shyn wrote:

Currently i'm using Tomcat 4.1 and my application uses the Tomcat's DBCP to 
connect to a Derby database.

However, since the Derby database only allow one application to connect to it 
at a time, is it possible that i could configure the Tomcat's DBCP connection 
so that other application (not web application) can uses it as well?

Any ideas and hints are welcomed.
  

Change the database?

--
Mikolaj Rydzewski [EMAIL PROTECTED]



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Sharing Tomcat DBCP connection

2006-09-14 Thread Marc Farrow

Mikolaj''s response may seem a bit curt, but the point is that one
connection to a database is very limiting and not real practical.

On 9/14/06, Mikolaj Rydzewski [EMAIL PROTECTED] wrote:


Foo Shyn wrote:
 Currently i'm using Tomcat 4.1 and my application uses the Tomcat's DBCP
to connect to a Derby database.

 However, since the Derby database only allow one application to connect
to it at a time, is it possible that i could configure the Tomcat's DBCP
connection so that other application (not web application) can uses it as
well?

 Any ideas and hints are welcomed.

Change the database?

--
Mikolaj Rydzewski [EMAIL PROTECTED]







--
Marc Farrow