Contact Us
    SearchSearch   RegisterRegister   Log inLog in 

Connection pooling problem in tomcat and linux

Connection pooling problem in tomcat and linux

Post new topic   Reply to topic     Forum Index -> Tomcat Installation Problems
View previous topic :: View next topic  
Author Message

Joined: 21 Feb 2007
Posts: 2

PostPosted: Wed Feb 21, 2007 7:24 am    Post subject: Connection pooling problem in tomcat and linux Reply with quote

I have getting connection pooling problem in fedora core 6. i am using apache tomcat 5.5.20 for linux version.
i have made enteries in context.xml in conf folder and also have tried in server.xml file in conf folder. and have made entry in WEB-INF/web.xml as

<description>MySQL Test App</description>
      <description>DB Connection</description>

and in conf/context.xml


       <Resource name="jdbc/PooledDB"














and also tried to put this code in conf/server.xml as


    <Context path="/DBTest" docBase="DBTest"
        debug="5" reloadable="true" crossContext="true">

    <!-- maxActive: Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.

    <!-- maxIdle: Maximum number of idle dB connections to retain in pool.
         Set to -1 for no limit.  See also the DBCP documentation on this
         and the minEvictableIdleTimeMillis configuration parameter.

    <!-- maxWait: Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.

    <!-- username and password: MySQL dB username and password for dB connections  -->

    <!-- driverClassName: Class name for the old mm.mysql JDBC driver is - we recommend using Connector/J though.
         Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
    <!-- url: The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
         connection.  mysqld by default closes idle connections after 8 hours.

  <Resource name="jdbc/PooledDB" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="root" password="" driverClassName="com.mysql.jdbc.Driver"


But it is still throwing error of connection refused


org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: ' Connection refused'.

MESSAGE: Connection refused

STACKTRACE: Connection refused
at com.mysql.jdbc.StandardSocketFactory.connect(
at com.mysql.jdbc.MysqlIO.<init>(
at com.mysql.jdbc.Connection.createNewIO(
at com.mysql.jdbc.Connection.<init>(
at com.mysql.jdbc.NonRegisteringDriver.connect(
at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(
at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(

if any one know this solution please help me
Back to top
View user's profile Send private message

Joined: 21 Feb 2007
Posts: 4

PostPosted: Wed Feb 21, 2007 2:02 pm    Post subject: Connection pooling problem in tomcat and linux Reply with quote

I also got same problem in fedore core 6 and tomcat 5.5.20 in few days before. i tried too many things for it.
i got many suggestion for it.

1. check jdbc permission in tomcat/config/catalina.policy
     permission    "*.localhost:8080",

but unforturenately it didnot worked with my case, it still shown error of connection refused

2. Check it which port you are running mysql normally it is 3306

        #mysql -h IPAddress -u root -p

if it is connecting without any error. then use this ip in your url string
Use instead 192.168.123 lan TCP/IP otherwise you have to bind this ip to localhost by bind-ip

last optional step
3. remove "skip-networking" in /etc/my.cnf file of mysql configure. with # and restart mysqld service
#service mysqld restart
good luck
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tomcat Installation Problems All times are GMT
Page 1 of 1

Jump to:  
  Quick Post a Reply Topic
  Name (required)  
  Email Address (will not be published) (required)  
  Subject of topic (required)  

  More Links  
JSP Introduction
JSP Setup
Simple JSP Example
JSP Variable
Array Declaration in JSP
JSP Forms and User Input
Form Validation
JSP Cookies
JSP Session Object
Loop, content collection, iterator, conditional check in JSP
JSP Application Object
JSP Include
JSP Response Object
JSP Request Object
JSP Error Handling
JSP File Handling Object
JSP Action Tag
JSP Implicit Objects
JSP Declaration
JSP Directive
JDBC Introduction
JDBC Driver
JDBC Connection
JDBC Prepared/Statement
JDBC ResultSet
JDBC Close Connection object
JDBC Insert
JDBC Display Records
JDBC Update
JDBC Delete
JDBC Sorting
JDBC Query
JDBC Exception
JDBC Add Batch
JDBC Transaction/RollBack