Re : Connection Closed Issue

2009-09-16 Thread Chetouani
Hi,

I had a similar problem.
I was using tomcat and mysql and configured a connection pool using dbcp.
The problem was that after some hours the application starts to throw an 
exception.
The exception was : communication link failure

The reason is that mysql is destroying the connectionz after some time (8 hours 
by default)
and the connection pool is not aware of that

I replaced dbcp by c3p0 and defined the maxConnectionAge to 3600s and the 
problem was solved


--- En date de : Mer 16.9.09, Sharath Babu S S S sharath.b...@solix.com a 
écrit :

De: Sharath Babu S S S sharath.b...@solix.com
Objet: Connection Closed Issue
À: users@tomcat.apache.org
Date: Mercredi 16 Septembre 2009, 11h52

Hi all,
 
we are using Tomcat server 5.5.20. Database is 9.0.28.
After starting tomcat and using our application after sometime we are getting 
the following error:
 
Can anyone suggest me, its really very urgent

Thread 78: SQLException While Purging the Selected Data From Source Table 
java.sql.SQLException: Connection 

oracle.jdbc.driver.t4cconnect...@1c9e95a is closed. for CONFIG 100019 For 
RUN_ID 100063

Debug: AJArchiveLogDetails.java Exception Occured While Inserting Data to 
AJArchiveLogDetails java.sql.SQLException: Connection oracle.jdbc.dr

iver.t4cconnect...@1c9e95a is closed.

    Debug: insertToAJArchiveLogDetails()

java.sql.SQLException: Connection oracle.jdbc.driver.t4cconnect...@1c9e95a is 
closed.

        at 
org.apache.tomcat.dbcp.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:354)

        at 
org.apache.tomcat.dbcp.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:246)

        at 
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:302)

        at 
beans.AJArchiveLogDetails.insertToAJArchiveLogDetails(AJArchiveLogDetails.java:177)

        at beans.PurgeProcess_T.run(PurgeProcess_T.java:281)

Debug: PurgeProcess_T.java: run() Thread 78: Exception While Updating the 
AJ_JOBS Table java.lang.Exception: java.sql.SQLException: Connection

 oracle.jdbc.driver.t4cconnect...@1c9e95a is closed. for CONFIG 100019 For 
RUN_ID 100063

Debug: PurgeProcess_T.java: run() Thread 78: Exception Releasing Resources 
java.sql.SQLException: Connection oracle.jdbc.driver.T4CConnection@

1c9e95a is closed. for CONFIG 100019 For RUN_ID 100063

 
With Regards
Sharat Babu Shravanam


Byte and Switch Names Solix Technologies 
One of the Top 10 Startups to Watch
 
Read More at http://www.solix.com/top10startups
-







 CAUTION - Disclaimer *

This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
solely for the use of the addressee(s). If you are not the intended
recipient, please notify the sender by e-mail and delete the original
message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are
unlawful. This e-mail may contain viruses. Solix has taken every
reasonable precaution to minimize this risk, but is not liable for any
damage you may sustain as a result of any virus in this e-mail. You
should carry out your own virus checks before opening the e-mail or
attachment. Solix reserves the right to monitor and review the content
of all messages sent to or from this e-mail address. Messages sent to or
from this e-mail address may be stored on the Solix e-mail system.


End of Disclaimer **






  

Re : How do I get hold of Tomcat JDBC pool lib

2009-09-16 Thread Chetouani
What about c3p0 ?

--- En date de : Mer 16.9.09, Gaurav Lohiya gloh...@gmail.com a écrit :

De: Gaurav Lohiya gloh...@gmail.com
Objet: How do I get hold of Tomcat JDBC pool lib
À: users@tomcat.apache.org
Date: Mercredi 16 Septembre 2009, 17h18

Hi,

I recently heard about the new Tomcat JDBC library, an alternative for the
DBCP lib. We see concurrency issues with the DBCP lib and are desperately
looking for a lib which can work in a highly concurrent application.

Had some questions about this lib...
1. Can this library be used with Tomcat 5.0.25. (ya I know this version was
used in the stone age :)) )
2. Is there a general release available
3. Where can I get binaries / src for the latest build (GA or beta)

Thanks in advance for your help.

- Gaurav


__
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible 
contre les messages non sollicités 
http://mail.yahoo.fr Yahoo! Mail 

Re: Re : Connection Closed Issue

2009-09-16 Thread Chetouani
Yes I defined the test query as well but it didn't fix the pb
The issue was fixed with the maxConnectionAge parameter

The exception was : 

# com.mysql.jdbc.CommunicationsException: Communications link failure due to 
underlying exception:

#

# ** BEGIN NESTED EXCEPTION **

#

# java.net.SocketException

# MESSAGE: Software caused connection abort: recv failed

#

# STACKTRACE:

#

# java.net.SocketException: Software caused connection abort: recv failed

# at java.net.SocketInputStream.socketRead0(Native Method)

# at java.net.SocketInputStream.read(Unknown Source)

My first config with c3p0 was :

bean id=dataSource class=com.mchange.v2.c3p0.ComboPooledDataSource

   property name=driverClass
 value=com.mysql.jdbc.Driver /

   property name=jdbcUrl 
value=jdbc:mysql://localhost:3306/mydb?relaxAutoCommit=trueamp;autoReconnect=true
 /

   property name=user value=user /

   property name=password value= /

   property name=initialPoolSize value=5 /

   property name=minPoolSize value=5 /

   property name=maxPoolSize value=20 /

   property name=checkoutTimeout value=1000/

   property name=acquireIncrement value=1/

   property name=testConnectionOnCheckin value=true/

   property name=testConnectionOnCheckout value=true/

   property name=preferredTestQuery value=SELECT 1/

   property name=idleConnectionTestPeriod
 value=60/

/bean

and now I added 

property name=maxConnectionAge
 value=3600/

--- En date de : Mer 16.9.09, Gaurav Lohiya gloh...@gmail.com a écrit :

De: Gaurav Lohiya gloh...@gmail.com
Objet: Re: Re : Connection Closed Issue
À: Tomcat Users List users@tomcat.apache.org
Date: Mercredi 16 Septembre 2009, 17h21

Do you have the validation query specified. I believe putting in the
validation query should solve the problem.

On Wed, Sep 16, 2009 at 11:17 AM, Chetouani kchet...@yahoo.fr wrote:

 Hi,

 I had a similar problem.
 I was using tomcat and mysql and configured a connection pool using dbcp.
 The problem was that after some hours the application starts to throw an
 exception.
 The exception was : communication link failure

 The reason is that mysql is destroying the connectionz after some time (8
 hours by default)
 and the connection pool is not aware of that

 I replaced dbcp by c3p0 and defined the maxConnectionAge to 3600s and the
 problem was solved


 --- En date de : Mer 16.9.09, Sharath Babu S S S sharath.b...@solix.com
 a écrit :

 De: Sharath Babu S S S sharath.b...@solix.com
 Objet: Connection Closed Issue
 À: users@tomcat.apache.org
 Date: Mercredi 16 Septembre 2009, 11h52

 Hi all,

 we are using Tomcat server 5.5.20. Database is 9.0.28.
 After starting tomcat and using our application after sometime we are
 getting the following error:

 Can anyone suggest me, its really very urgent

 Thread 78: SQLException While Purging the Selected Data From Source Table
 java.sql.SQLException: Connection

 oracle.jdbc.driver.t4cconnect...@1c9e95a is closed. for CONFIG 100019 For
 RUN_ID 100063

 Debug: AJArchiveLogDetails.java Exception Occured While Inserting Data to
 AJArchiveLogDetails java.sql.SQLException: Connection oracle.jdbc.dr

 iver.t4cconnect...@1c9e95a is closed.

     Debug: insertToAJArchiveLogDetails()

 java.sql.SQLException: Connection oracle.jdbc.driver.t4cconnect...@1c9e95ais 
 closed.

         at
 org.apache.tomcat.dbcp.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:354)

         at
 org.apache.tomcat.dbcp.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:246)

         at
 org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:302)

         at
 beans.AJArchiveLogDetails.insertToAJArchiveLogDetails(AJArchiveLogDetails.java:177)

         at beans.PurgeProcess_T.run(PurgeProcess_T.java:281)

 Debug: PurgeProcess_T.java: run() Thread 78: Exception While Updating the
 AJ_JOBS Table java.lang.Exception: java.sql.SQLException: Connection

  oracle.jdbc.driver.t4cconnect...@1c9e95a is closed. for CONFIG 100019 For
 RUN_ID 100063

 Debug: PurgeProcess_T.java: run() Thread 78: Exception Releasing Resources
 java.sql.SQLException: Connection oracle.jdbc.driver.T4CConnection@

 1c9e95a is closed. for CONFIG 100019 For RUN_ID 100063


 With Regards
 Sharat Babu Shravanam

 
 Byte and Switch Names Solix Technologies
 One of the Top 10 Startups to Watch

 Read More at http://www.solix.com/top10startups
 -







  CAUTION - Disclaimer *

 This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
 solely for the use of the addressee(s). If you are not the intended
 recipient, please notify the sender by e-mail and delete the original
 message. Further, you are not to copy, disclose, or distribute this
 e-mail or its contents to any other person and any such actions are
 unlawful. This e

Re: tomcat mysql dbcp Communications link failure

2009-09-15 Thread Chetouani
Hi David,

Thanks for your answer.

At the moment I don't have the stack trace but it something like 

# com.mysql.jdbc.CommunicationsException: Communications link failure due to 
underlying exception:
#
# ** BEGIN NESTED EXCEPTION **
#
# java.net.SocketException
# MESSAGE: Software caused connection abort: recv failed
#
# STACKTRACE:
#
# java.net.SocketException: Software caused connection abort: recv failed
# at java.net.SocketInputStream.socketRead0(Native Method)
# at java.net.SocketInputStream.read(Unknown Source)
...

I was using dbcp and I changed to c3p0 beacause I read that with c3p0 we can 
add paramters to test the connections

My config now is :

bean id=dataSource class=com.mchange.v2.c3p0.ComboPooledDataSource
   property name=driverClass value=com.mysql.jdbc.Driver /
   property name=jdbcUrl 
value=jdbc:mysql://localhost:3306/mydb?relaxAutoCommit=trueamp;autoReconnect=true
 /
   property name=user value=user /
   property name=password value= /
   property name=initialPoolSize value=5 /
   property name=minPoolSize value=5 /
   property name=maxPoolSize value=20 /
   property name=checkoutTimeout value=1000/
   property name=acquireIncrement value=1/
   property name=testConnectionOnCheckin value=true/
   property name=testConnectionOnCheckout value=true/
   property name=preferredTestQuery value=SELECT 1/
   property name=idleConnectionTestPeriod value=60/
/bean

But I get the same error

I don't know exactly the time it takes but I didn't change anything in mysql so 
I assume it's 8 hours (some hours at least). If you know how to change this 
value...

I use spring, hibernate/jpa and I am not dealing with the connections at all. I 
am just injecting the data source like this :

!-- Creates a EntityManagerFactory for use with the Hibernate JPA provider and 
data source --
bean id=entityManagerFactory 
class=org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
  property name=dataSource ref=dataSource /
  property name=jpaVendorAdapter
    bean class=org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter 
/
  /property
/bean

If you have an idea or questions...

Thanks for you help

--- En date de : Lun 14.9.09, David Smith d...@cornell.edu a écrit :

De: David Smith d...@cornell.edu
Objet: Re: tomcat mysql dbcp Communications link failure
À: Tomcat Users List users@tomcat.apache.org
Date: Lundi 14 Septembre 2009, 4h47

Could you provide the full stack trace?  And if possible, can you
describe time it takes as it relates to the timeout of your MySQL
server?  The default timeout in MySQL is 8 hours, but is configurable. 
Also I'm assuming all the ${...} stuff is just you sanitizing the
Resource ... / block.  One last question ... is there any chance your
code is holding on to connections as opposed to closing them when done? 
Closing from the app's point of view is just returning the connection to
the pool for another request later.

--David

Chetouani wrote:
 Hello guys,

 If you can help with this problem.

 I have an application deployed on tomcat V6.18. It uses a mysql database.
 The problem is that after some hours the applicatiion throws an exception 
 when trying to connect to the data base.

 com.mysql.jdbc.CommunicationsException: Communications link failure due to 
 underlying exception

 I cofigured a data source using dbcp :

 Resource name=jdbc/${database.datasource} 
         auth=Container
         type=javax.sql.DataSource 
         factory=org.apache.commons.dbcp.BasicDataSourceFactory 
         driverClassName=${database.driver} 
         url=${database.url} 
         username=${database.user}
         password=${database.password} 
         removeAbandoned=true
         removeAbandonedTimeout=300
         logAbandoned=true
         maxActive=20
         maxIdle=20
         maxWait=1
         validationQuery=SELECT 1
         testOnBorrow=true
         testOnReturn=true
         testWhileIdle=true/

 I did some searches and it seems that the problem is that the connection pool 
 keeps the connections for a long time even if they are considered dead by 
 mysql

 So if you can help

 Thanks


   


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




  

tomcat mysql dbcp Communications link failure

2009-09-13 Thread Chetouani
Hello guys,

If you can help with this problem.

I have an application deployed on tomcat V6.18. It uses a mysql database.
The problem is that after some hours the applicatiion throws an exception when 
trying to connect to the data base.

com.mysql.jdbc.CommunicationsException: Communications link failure due to 
underlying exception

I cofigured a data source using dbcp :

Resource name=jdbc/${database.datasource} 
        auth=Container
        type=javax.sql.DataSource 
        factory=org.apache.commons.dbcp.BasicDataSourceFactory 
        driverClassName=${database.driver} 
        url=${database.url} 
        username=${database.user}
        password=${database.password} 
        removeAbandoned=true
        removeAbandonedTimeout=300
        logAbandoned=true
        maxActive=20
        maxIdle=20
        maxWait=1
        validationQuery=SELECT 1
        testOnBorrow=true
        testOnReturn=true
        testWhileIdle=true/

I did some searches and it seems that the problem is that the connection pool 
keeps the connections for a long time even if they are considered dead by mysql

So if you can help

Thanks