You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jon Wilmoth <jo...@yahoo.com> on 2003/10/07 00:03:30 UTC
[dbcp] Connection pooling error w/MySQL
I'm attempting a port of a webapp from oracle to mysql
(tight budget ;). Unfortunately, I'm experiencing
problems with the DataSource implementation provided
with Tomcat 4.1.27 and MySQL that I didn't have with
Tomcat & Oracle. The error is below.
I'm able to successfully connect to the MySQL server
via other clients including: MySQL Control Center,
Ant's Sql task and a test java client that has the
following code:
private Connection getConnection() {//load driver try{
Class.forName(driverClassName); } catch
(ClassNotFoundException cnfe) { log(driverClassName +
" is not in the classpath"); System.exit(1); }
Connection conn = null; try { conn =
DriverManager.getConnection(dbURL, dbUser,dbPwd);
conn.setAutoCommit(false); } catch (Exception e) {
log("getConnection failed to connect to '" + dbURL +
"' with user '" + dbUser + "'", e); System.exit(1); }
return conn;}
Any idea why DBCP would have problems?
DBCP borrowObject failed: java.sql.SQLException:
Unable to connect to any hosts due to exception:
java.net.BindException: Address already in use:
connectorg.apache.commons.dbcp.DbcpException:
java.sql.SQLException: Unable to connect to any hosts
due to exception: java.net.BindException: Address
already in use: connect at
org.apache.commons.dbcp.DriverConnectionFactory.createConnectionDriverConnectionFactory.java:85)
at
org.apache.commons.dbcp.PoolableConnectionFactory.makeObjectPoolableConnectionFactory.java:184)
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObjectGenericObjectPool.java:722)
at
org.apache.commons.dbcp.AbandonedObjectPool.borrowObjectAbandonedObjectPool.java:117)
at
org.apache.commons.dbcp.PoolingDataSource.getConnectionPoolingDataSource.java:108)
at
org.apache.commons.dbcp.BasicDataSource.getConnectionBasicDataSource.java:312)
at
com.apex.chronos.app.DatabaseDelegate.getPooledConnectionDatabaseDelegate.java:70)
at
com.apex.chronos.app.DatabaseDelegate.logConnectionInfoDatabaseDelegate.java:34)
at
com.apex.chronos.Startup.testConnectionPool(Startup.java:384)
at
com.apex.chronos.Startup.init(Startup.java:183)
at
org.apache.catalina.core.StandardWrapper.loadServletStandardWrapper.java:935)
at
org.apache.catalina.core.StandardWrapper.loadStandardWrapper.java:823)
at
org.apache.catalina.core.StandardContext.loadOnStartupStandardContext.java:3421)
at
org.apache.catalina.core.StandardContext.startStandardContext.java:3609)
at
org.apache.catalina.core.ContainerBase.startContainerBase.java:1188)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at
org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at
org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at
org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)Caused
by: java.sql.SQLException: Unable to connect to any
hosts due to exception: java.net.BindException:
Address already in use: connect at
com.mysql.jdbc.Connection.createNewIO(Connection.java:1622)
at
com.mysql.jdbc.Connection.<init>(Connection.java:491)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
at
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83)
... 27 more
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [dbcp] Connection pooling error w/MySQL
Posted by Jon Wilmoth <jo...@yahoo.com>.
Thanks, I've gotten the BindException before when
trying to startup two instances of an appserver, but I
don't believe Tomcat itself is the problem. Tomcat's
running on 8080 and MySQL is running on the default
port of 3306. I'm pretty sure there isn't anything
else running on 3306 otherwise the MySQL server itself
wouldn't be able to startup, let alone the client
applications (MySQL Control Center, Ant SQL task,
etc.).
--- __matthewHawthorne <ma...@phreaker.net> wrote:
> I've received the "java.net.BindException: Address
> already in use" error
> when I attempted to run on a port that was already
> in use. Perhaps try
> shutting down your Tomcat and making sure that no
> other apps are using
> port 8080 or whichever one you're using.
>
>
>
>
> Jon Wilmoth wrote:
>
> > I'm attempting a port of a webapp from oracle to
> mysql
> > (tight budget ;). Unfortunately, I'm experiencing
> > problems with the DataSource implementation
> provided
> > with Tomcat 4.1.27 and MySQL that I didn't have
> with
> > Tomcat & Oracle. The error is below.
> >
> > I'm able to successfully connect to the MySQL
> server
> > via other clients including: MySQL Control Center,
> > Ant's Sql task and a test java client that has the
> > following code:
> >
> > private Connection getConnection() {//load driver
> try{
> > Class.forName(driverClassName); } catch
> > (ClassNotFoundException cnfe) {
> log(driverClassName +
> > " is not in the classpath"); System.exit(1); }
> > Connection conn = null; try { conn =
> > DriverManager.getConnection(dbURL, dbUser,dbPwd);
> > conn.setAutoCommit(false); } catch (Exception e) {
>
> > log("getConnection failed to connect to '" + dbURL
> +
> > "' with user '" + dbUser + "'", e);
> System.exit(1); }
> > return conn;}
> >
> > Any idea why DBCP would have problems?
> >
> > DBCP borrowObject failed: java.sql.SQLException:
> > Unable to connect to any hosts due to exception:
> > java.net.BindException: Address already in use:
> > connectorg.apache.commons.dbcp.DbcpException:
> > java.sql.SQLException: Unable to connect to any
> hosts
> > due to exception: java.net.BindException: Address
> > already in use: connect at
> >
>
org.apache.commons.dbcp.DriverConnectionFactory.createConnectionDriverConnectionFactory.java:85)
> > at
> >
>
org.apache.commons.dbcp.PoolableConnectionFactory.makeObjectPoolableConnectionFactory.java:184)
> > at
> >
>
org.apache.commons.pool.impl.GenericObjectPool.borrowObjectGenericObjectPool.java:722)
> > at
> >
>
org.apache.commons.dbcp.AbandonedObjectPool.borrowObjectAbandonedObjectPool.java:117)
> > at
> >
>
org.apache.commons.dbcp.PoolingDataSource.getConnectionPoolingDataSource.java:108)
> > at
> >
>
org.apache.commons.dbcp.BasicDataSource.getConnectionBasicDataSource.java:312)
> > at
> >
>
com.apex.chronos.app.DatabaseDelegate.getPooledConnectionDatabaseDelegate.java:70)
> > at
> >
>
com.apex.chronos.app.DatabaseDelegate.logConnectionInfoDatabaseDelegate.java:34)
> > at
> >
>
com.apex.chronos.Startup.testConnectionPool(Startup.java:384)
> > at
> > com.apex.chronos.Startup.init(Startup.java:183)
>
> > at
> >
>
org.apache.catalina.core.StandardWrapper.loadServletStandardWrapper.java:935)
> > at
> >
>
org.apache.catalina.core.StandardWrapper.loadStandardWrapper.java:823)
> > at
> >
>
org.apache.catalina.core.StandardContext.loadOnStartupStandardContext.java:3421)
> > at
> >
>
org.apache.catalina.core.StandardContext.startStandardContext.java:3609)
> > at
> >
>
org.apache.catalina.core.ContainerBase.startContainerBase.java:1188)
> > at
> >
>
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
> > at
> >
>
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
> > at
> >
>
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
> > at
> >
>
org.apache.catalina.core.StandardService.start(StandardService.java:497)
> > at
> >
>
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
> > at
> >
>
org.apache.catalina.startup.Catalina.start(Catalina.java:512)
> > at
> >
>
org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
> > at
> >
>
org.apache.catalina.startup.Catalina.process(Catalina.java:180)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method) at
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > at
> > java.lang.reflect.Method.invoke(Method.java:324)
>
> > at
> >
>
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)Caused
> > by: java.sql.SQLException: Unable to connect to
> any
> > hosts due to exception: java.net.BindException:
> > Address already in use: connect at
> >
>
com.mysql.jdbc.Connection.createNewIO(Connection.java:1622)
> > at
> >
>
com.mysql.jdbc.Connection.<init>(Connection.java:491)
>
> > at
> >
>
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
> > at
> >
>
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83)
> > ... 27 more
> >
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Shopping - with improved product
> search
> > http://shopping.yahoo.com
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [dbcp] Connection pooling error w/MySQL
Posted by __matthewHawthorne <ma...@phreaker.net>.
I've received the "java.net.BindException: Address already in use" error
when I attempted to run on a port that was already in use. Perhaps try
shutting down your Tomcat and making sure that no other apps are using
port 8080 or whichever one you're using.
Jon Wilmoth wrote:
> I'm attempting a port of a webapp from oracle to mysql
> (tight budget ;). Unfortunately, I'm experiencing
> problems with the DataSource implementation provided
> with Tomcat 4.1.27 and MySQL that I didn't have with
> Tomcat & Oracle. The error is below.
>
> I'm able to successfully connect to the MySQL server
> via other clients including: MySQL Control Center,
> Ant's Sql task and a test java client that has the
> following code:
>
> private Connection getConnection() {//load driver try{
> Class.forName(driverClassName); } catch
> (ClassNotFoundException cnfe) { log(driverClassName +
> " is not in the classpath"); System.exit(1); }
> Connection conn = null; try { conn =
> DriverManager.getConnection(dbURL, dbUser,dbPwd);
> conn.setAutoCommit(false); } catch (Exception e) {
> log("getConnection failed to connect to '" + dbURL +
> "' with user '" + dbUser + "'", e); System.exit(1); }
> return conn;}
>
> Any idea why DBCP would have problems?
>
> DBCP borrowObject failed: java.sql.SQLException:
> Unable to connect to any hosts due to exception:
> java.net.BindException: Address already in use:
> connectorg.apache.commons.dbcp.DbcpException:
> java.sql.SQLException: Unable to connect to any hosts
> due to exception: java.net.BindException: Address
> already in use: connect at
> org.apache.commons.dbcp.DriverConnectionFactory.createConnectionDriverConnectionFactory.java:85)
> at
> org.apache.commons.dbcp.PoolableConnectionFactory.makeObjectPoolableConnectionFactory.java:184)
> at
> org.apache.commons.pool.impl.GenericObjectPool.borrowObjectGenericObjectPool.java:722)
> at
> org.apache.commons.dbcp.AbandonedObjectPool.borrowObjectAbandonedObjectPool.java:117)
> at
> org.apache.commons.dbcp.PoolingDataSource.getConnectionPoolingDataSource.java:108)
> at
> org.apache.commons.dbcp.BasicDataSource.getConnectionBasicDataSource.java:312)
> at
> com.apex.chronos.app.DatabaseDelegate.getPooledConnectionDatabaseDelegate.java:70)
> at
> com.apex.chronos.app.DatabaseDelegate.logConnectionInfoDatabaseDelegate.java:34)
> at
> com.apex.chronos.Startup.testConnectionPool(Startup.java:384)
> at
> com.apex.chronos.Startup.init(Startup.java:183)
> at
> org.apache.catalina.core.StandardWrapper.loadServletStandardWrapper.java:935)
> at
> org.apache.catalina.core.StandardWrapper.loadStandardWrapper.java:823)
> at
> org.apache.catalina.core.StandardContext.loadOnStartupStandardContext.java:3421)
> at
> org.apache.catalina.core.StandardContext.startStandardContext.java:3609)
> at
> org.apache.catalina.core.ContainerBase.startContainerBase.java:1188)
> at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
> at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
> at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
> at
> org.apache.catalina.core.StandardService.start(StandardService.java:497)
> at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
> at
> org.apache.catalina.startup.Catalina.start(Catalina.java:512)
> at
> org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
> at
> org.apache.catalina.startup.Catalina.process(Catalina.java:180)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at
> java.lang.reflect.Method.invoke(Method.java:324)
> at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)Caused
> by: java.sql.SQLException: Unable to connect to any
> hosts due to exception: java.net.BindException:
> Address already in use: connect at
> com.mysql.jdbc.Connection.createNewIO(Connection.java:1622)
> at
> com.mysql.jdbc.Connection.<init>(Connection.java:491)
> at
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
> at
> org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83)
> ... 27 more
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org