You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by te...@free.fr on 2003/12/28 15:32:03 UTC
[jelly][newbie question] How to turn logging feature on ?
Hello.
I'm sorry to borrow you with this newbie question, but, I would to turn the
debug log on in the jelly tag.
How can I do this or where theses logs are written ?
Thanks
Marc DEXET
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
RE: common-dbcp_1.1 and common-pool_1.1 question
Posted by Shazard <Sh...@mits.lv>.
Thanks very much!
I noticed this strange coding before but was unsure where
it would be the right place to patch!
Thanks again! Will try to contact MySQL people!
-----Original Message-----
From: Dirk Verbeeck [mailto:dirk.verbeeck@pandora.be]
Sent: Tuesday, December 30, 2003 12:59 AM
To: Jakarta Commons Users List
Subject: Re: common-dbcp_1.1 and common-pool_1.1 question
The problem is inside the MySQL driver.
This is from the GNU licensed MySQL driver:
public synchronized void close() throws SQLException {
physicalConn.close();
physicalConn = null;
callListener(CONNECTION_CLOSED_EVENT, null);
}
As you can see there is no test if the physicalConn is null.
The getConnection() method has this test so I think it's a bug in the
driver. I would change this method to:
public synchronized void close() throws SQLException {
if (physicalConn != null {
physicalConn.close();
}
physicalConn = null;
callListener(CONNECTION_CLOSED_EVENT, null);
}
Please report this to the MySQL people if this patch proves to be
correct. (and drop a note on this list to warn other people)
To fix it you can patch the MySQL driver or ignore the NullPointer by
patching KeyedCPDSConnectionFactory.destroyObject.
Another approach would be to use the jdbc1 MySQL connections and turn
them into jdbc2 using the DriverAdapterCPDS (and use that one for your
SharedPoolDataSource)
If you don't need the getConnection(String username, String password)
method then you can always switch to the BasicDataSource if you don't
want to patch and require a simple solution.
-- Dirk
Shazard wrote:
> Hi There!
>
> I am getting strange exception all the time!
> It does not breaks anything but it is annoying!
>
> As far as I found out it is because of MySQL times out it's connection
> and then connecetion evictor finds that out. But it finds it out by
> calling
> getConnection where the exception is thrown and as result of this
> exception
> pool manager tries to close() connection and gets more exceptions.
> How should I create my MySQL based connection pool using mensioned
> packages
> to avoid this problem?
>
> Please help!
>
> Here is exception!
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: common-dbcp_1.1 and common-pool_1.1 question
Posted by Dirk Verbeeck <di...@pandora.be>.
The problem is inside the MySQL driver.
This is from the GNU licensed MySQL driver:
public synchronized void close() throws SQLException {
physicalConn.close();
physicalConn = null;
callListener(CONNECTION_CLOSED_EVENT, null);
}
As you can see there is no test if the physicalConn is null.
The getConnection() method has this test so I think it's a bug in the
driver. I would change this method to:
public synchronized void close() throws SQLException {
if (physicalConn != null {
physicalConn.close();
}
physicalConn = null;
callListener(CONNECTION_CLOSED_EVENT, null);
}
Please report this to the MySQL people if this patch proves to be
correct. (and drop a note on this list to warn other people)
To fix it you can patch the MySQL driver or ignore the NullPointer by
patching KeyedCPDSConnectionFactory.destroyObject.
Another approach would be to use the jdbc1 MySQL connections and turn
them into jdbc2 using the DriverAdapterCPDS (and use that one for your
SharedPoolDataSource)
If you don't need the getConnection(String username, String password)
method then you can always switch to the BasicDataSource if you don't
want to patch and require a simple solution.
-- Dirk
Shazard wrote:
> Hi There!
>
> I am getting strange exception all the time!
> It does not breaks anything but it is annoying!
>
> As far as I found out it is because of MySQL times out it's connection
> and then connecetion evictor finds that out. But it finds it out by
> calling
> getConnection where the exception is thrown and as result of this
> exception
> pool manager tries to close() connection and gets more exceptions.
> How should I create my MySQL based connection pool using mensioned
> packages
> to avoid this problem?
>
> Please help!
>
> Here is exception!
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
common-dbcp_1.1 and common-pool_1.1 question
Posted by Shazard <Sh...@mits.lv>.
Hi There!
I am getting strange exception all the time!
It does not breaks anything but it is annoying!
As far as I found out it is because of MySQL times out it's connection
and then connecetion evictor finds that out. But it finds it out by
calling
getConnection where the exception is thrown and as result of this
exception
pool manager tries to close() connection and gets more exceptions.
How should I create my MySQL based connection pool using mensioned
packages
to avoid this problem?
Please help!
Here is exception!
EXCEPTION WHILE DESTROYING OBJECT
org.apache.commons.dbcp.datasources.PooledConnectionAndInfo@63a721
java.lang.NullPointerException
at
com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection.close(MysqlPooledCon
nection.java:145)
at
org.apache.commons.dbcp.datasources.KeyedCPDSConnectionFactory.destroyOb
ject(KeyedCPDSConnectionFac
tory.java:184)
at
org.apache.commons.dbcp.datasources.KeyedCPDSConnectionFactory.connectio
nErrorOccurred(KeyedCPDSCon
nectionFactory.java:307)
at
com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection.callListener(MysqlPo
oledConnection.java:180)
at
com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection.getConnection(MysqlP
ooledConnection.java:115)
at
org.apache.commons.dbcp.datasources.KeyedCPDSConnectionFactory.validateO
bject(KeyedCPDSConnectionFa
ctory.java:204)
at
org.apache.commons.pool.impl.GenericKeyedObjectPool.evict(GenericKeyedOb
jectPool.java:1042)
at
org.apache.commons.pool.impl.GenericKeyedObjectPool$Evictor.run(GenericK
eyedObjectPool.java:1201)
at java.lang.Thread.run(Thread.java:536)
Here is my class
package freelancers.database;
import org.apache.commons.dbcp.datasources.SharedPoolDataSource;
//import org.apache.commons.pool.*;
//import org.apache.commons.pool.impl.*;
import freelancers.util.Utils;
import com.mysql.jdbc.jdbc2.optional.*;
/**
* <p>Title: Freelancers Web Project</p>
* <p>Description: Project to gather different IT freelancers &
customers. The
* web application actually will be database with available freelancers
and
* available projects.</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: Freelancers</p>
* @author Janis Olekss aka Shazard
* @version 1.0
*/
public class MysqlPoolingDataSource extends SharedPoolDataSource {
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource dataSource
= null;
public MysqlPoolingDataSource() {
dataSource = new
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource();
this.setConnectionPoolDataSource(dataSource);
this.setValidationQuery("select 1 from forums limit 1");
this.setTestOnBorrow(true);
this.setMinEvictableIdleTimeMillis(30 * 1000 * 60);
this.setNumTestsPerEvictionRun(3);
this.setTestWhileIdle(true);
this.setTimeBetweenEvictionRunsMillis(60*1000);
}
public void setServerName(String server) {
dataSource.setServerName(server);
}
public void setPort(int port) {
dataSource.setPort(port);
}
public void setUser(String user) {
dataSource.setUser(user);
}
public void setPassword(String password) {
dataSource.setPassword(password);
}
public void setDatabaseName(String databaseName) {
dataSource.setDatabaseName(databaseName);
}
public void setURL(String url) {
dataSource.setURL(url);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org