Sorry for jumping in late in the thread but I assume you covered the basics as in granting your Socket the ability to connect as in $CATALINA_HOME/conf/catalina.policy grant { permission java.net.SocketPermission "NameOfDBGoesHere:PortNumberGoesHere", "accept,connect,listen,resolve"; } ? Martin-- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents ----- Original Message ----- From: "tyju tiui" <[EMAIL PROTECTED]> To: "Tomcat Users List" <users@tomcat.apache.org> Sent: Saturday, November 18, 2006 10:32 PM Subject: Re: Pooling Issue
I do have a firewall, but I tried opening port 3306 and still had the same problem. I don't know what could be impeding the connection since I'm able to connect to mysql from the server. Is there any other way for me to test the connection using from tomcat? Maybe an interactive logon or something? The root cause is: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.net.ConnectException: Connection refused STACKTRACE: java.net.SocketException: java.net.ConnectException: Connection refused at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666) at com.mysql.jdbc.Connection.<init>(Connection.java:1531) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290) at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(Unknown Source) at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(Unknown Source) at org.apache.jsp.test_jsp._jspx_meth_sql_query_0(test_jsp.java:100) at org.apache.jsp.test_jsp._jspService(test_jsp.java:58) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) ** END NESTED EXCEPTION ** Last packet sent to the server was 21 ms ago.)" org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(Unknown Source) org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(Unknown Source) org.apache.jsp.test_jsp._jspx_meth_sql_query_0(test_jsp.java:100) org.apache.jsp.test_jsp._jspService(test_jsp.java:58) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) ----- Original Message ---- From: David Smith <[EMAIL PROTECTED]> To: Tomcat Users List <users@tomcat.apache.org> Sent: Saturday, November 18, 2006 9:28:46 PM Subject: Re: Pooling Issue Well that's a stumper. The connection refused exception implies that nothing is listening on that port or the port is blocked by a firewall. Is there any more to that exception like a root cause? Given you are using the localhost interface, I doubt this has a bearing but would you happen to have any iptables or other firewall software active? In short is there anything in your system that might prevent the connection? --David tyju tiui wrote: > Hi David, > > Thank you so much for the response and good advice. > I verified that I was able to connect to MySQL using > the command you suggested (via port 3306). I also > removed the autoReconnect parameter and moved the > pooling config out to Catalina/localhost/DBTest.xml. I > restarted tomcat and I'm still having the same issue. > > Do you have any other ideas? > > Thanks again, > > Ty > > > > --- David Smith <[EMAIL PROTECTED]> wrote: > > >> For starters, you might want to make a copy of your >> server.xml file for >> documentation purposes and then drop all the >> comments from the active >> one. The documentation comments are excellent, but >> they make the >> serverl.xml near impossible to read. >> >> At any rate.... the exception is connection refused. >> Are you sure your >> MySQL server is listening on port 3306? Some >> default configurations use >> unix sockets exclusively -- something java JDBC >> drivers can't do. Try >> this from the same machine your server is on: >> >> mysql -h localhost -P 3306 -u rpd -p >> >> The above command forces mysql client to connect via >> TCP/IP with userid >> rpd and prompt for a password. If this works, then >> we're looking at >> something else. If this doesn't, reconfigure your >> mysql server to >> listen on tcp/ip port 3306 and try again. >> >> Some additional recommendations -- not directly >> related to your issue, >> but worth mentioning: >> >> The <Context ...> ... </Context> block should be in >> it's own xml file >> under conf/Catalina/localhost, named to match the >> context of your webapp >> -- DBTest.xml in your case. Avoid setting this in >> server.xml as it >> requires restarting the tomcat container every time >> you want to make a >> change to your webapp's config. >> >> Drop the autoReconnect=true from your database url. >> It isn't >> recommended by MySQL and doesn't make sense in a >> database connection >> pool anyway. >> >> --David >> >> tyju tiui wrote: >> >>> I'm having problems setting up connection pooling >>> >> with >> >>> comcat 5.5.2.0 and MySQL 5.0.24 using mysql >>> connector/J 5.0. >>> >>> I've setup / populated a test database and >>> >> verified >> >>> that I can login to the server/db using the >>> >> specified >> >>> username/password/host found in the connection >>> >> string. >> >>> My server.xml looks like this: >>> >>> >>> >> <snipped here .... a lot of irrelevant stuff to >> the issue at hand. /> >> >>> <!-- ********** Pooling Config ********** >>> >> --> >> >>> <Context path="/DBTest" docBase="DBTest" >>> debug="5" reloadable="true" >>> crossContext="true"> >>> >>> >>> >>> >> < snipped again...../> >> >>> <Resource name="jdbc/TestDB" >>> auth="Container" >>> type="javax.sql.DataSource" >>> >>> >>> > factory="org.apache.commons.dbcp.BasicDataSourceFactory" > >>> maxActive="100" >>> username="rpd" >>> password="2wERk4rpd" >>> maxIdle="30" >>> maxWait="10000" >>> >>> driverClassName="com.mysql.jdbc.Driver" >>> removeAbandoned="true" >>> >>> >>> > url="jdbc:mysql://localhost:3306/phptest?autoReconnect=true" > >>> /> >>> >>> </Context> >>> <!-- ********** End Pooling ********** --> >>> >>> </Host> >>> >>> </Engine> >>> >>> </Service> >>> >>> </Server> >>> >>> >>> >>> >>> >>> >>> >>> I'm using the sample web.xml and test.jsp found >>> >> at: >> > http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html > >>> >>> >>> >>> >>> There error I'm getting is: >>> >>> org.apache.jasper.JasperException: Unable to get >>> connection, DataSource invalid: >>> "org.apache.commons.dbcp.SQLNestedException: >>> >> Cannot >> >>> create PoolableConnectionFactory (Server >>> >> connection >> >>> failure during transaction. Due to underlying >>> exception: 'java.net.SocketException: >>> java.net.ConnectException: Connection refused'. >>> >>> ** BEGIN NESTED EXCEPTION ** >>> >>> java.net.SocketException >>> MESSAGE: java.net.ConnectException: Connection >>> >> refused >> >>> STACKTRACE: >>> >>> java.net.SocketException: >>> >> java.net.ConnectException: >> >>> Connection refused >>> at >>> >>> > com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156) > >>> at >>> >> com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276) >> >>> at >>> >>> > com.mysql.jdbc.Connection.createNewIO(Connection.java:2815) > >>> at >>> >>> > com.mysql.jdbc.Connection.<init>(Connection.java:1531) > >>> at >>> >>> > com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266) > >>> at >>> >>> > org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37) > >>> at >>> >>> > org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290) > >>> at >>> >>> > org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877) > >>> at >>> >>> > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851) > >>> at >>> >>> > org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) > >>> at >>> >>> > org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(Unknown > >>> Source) >>> at >>> >>> > org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(Unknown > >>> Source) >>> at >>> >>> > org.apache.jsp.test_jsp._jspx_meth_sql_query_0(test_jsp.java:100) > >>> at >>> >>> > org.apache.jsp.test_jsp._jspService(test_jsp.java:58) > >>> at >>> >>> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) > >>> at >>> >>> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > >>> at >>> >>> > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334) > >>> at >>> >>> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) > >>> at >>> >>> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) > > === message truncated === > > > > > ____________________________________________________________________________________ > Sponsored Link > > $420k for $1,399/mo. > Think You Pay Too Much For Your Mortgage? > Find Out! www.LowerMyBills.com/lre > > --------------------------------------------------------------------- > 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] ____________________________________________________________________________________ Sponsored Link Mortgage rates near 39yr lows. $420k for $1,399/mo. Calculate new payment! www.LowerMyBills.com/lre