Re: [Resin-interest] MySQL issues with 4.0.18
You probably have your mysql server configured to only accept socket connections, and not TCP/IP connections. As a rule, external client programs use TCP/IP by default, as sockets can only be used if the db server is on the same machine as the client program and this is often not the case for production applications. See http://dev.mysql.com/doc/refman/5.0/en/connecting.html for more information. Rachel On Thu, May 26, 2011 at 4:29 PM, Rick Mann rm...@latencyzero.com wrote: I'm trying to set my webapp up on a new server, and running into something I've never seen before. Google has solutions for people that worked, but none of them work for me. The same config on OpenSolaris and OS X work (albeit with different versions of MySQL and Resin). I'm not sure if this is new with 4.0.18 or not. I have MySQL and Resin 4.0.18 running on the same host. I have my Java webapp, and WordPress both installed. Whenever either one tries to access the DB, access is refused. Each webapp uses its own user/password. I've verified that I can access MySQL via the mysql command-line client using both sets of credentials. WordPress reports this error: /lz/usr/wordpress/wp-includes/wp-db.php:509: Warning: A link to the server could not be established. url=jdbc:mysql://localhost:3306/?characterEncoding=ISO8859_1 driver=com.mysql.jdbc.Driver com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. [mysql_error] MySQL: 5.5.12 Connector/J: 5.1.15 Resin: 4.0.18 OS: 4.4.3-4ubuntu5 My Java app reports Connection refused (long stacktrace follows). The MySQL JDBC connector is in webapp-jars. The config for the Java webapp looks like: database jndi-namejdbc/mydb/jndi-name max-connections1024/max-connections max-idle-time30s/max-idle-time driver typecom.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource/type urljdbc:mysql://localhost:3306/mydb/url usermydb/user password#/password /driver /database WordPress config: define('DB_NAME', 'wordpress'); define('DB_USER', 'wordpress'); define('DB_PASSWORD', ''); define('DB_HOST', 'localhost'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); Webapp error: java.net.ConnectException: Connection refused javax.servlet.ServletException: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) at javax.servlet.http.HttpServlet.service(HttpServlet.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:96) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109) at com.latencyzero.satdb.RequestFilter.doFilter(RequestFilter.java:124) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.latencyzero.satdb.SecurityFilter.doFilter(SecurityFilter.java:228) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156) at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:287) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:792) at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:730) at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:689) at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:669) at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:617) at com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:104) at com.caucho.network.listen.ConnectionReadTask.runThread(ConnectionReadTask.java:98) at com.caucho.network.listen.ConnectionReadTask.run(ConnectionReadTask.java:81) at com.caucho.network.listen.AcceptTask.run(AcceptTask.java:67) at
Re: [Resin-interest] MySQL issues with 4.0.18
Thank you, Rachel, that does indeed seem to be the case. Is it not possible to get Connector/J to use a socket underneath, if it's running on the same host? -- Rick On May 26, 2011, at 17:09 , Rachel McConnell wrote: You probably have your mysql server configured to only accept socket connections, and not TCP/IP connections. As a rule, external client programs use TCP/IP by default, as sockets can only be used if the db server is on the same machine as the client program and this is often not the case for production applications. See http://dev.mysql.com/doc/refman/5.0/en/connecting.html for more information. Rachel On Thu, May 26, 2011 at 4:29 PM, Rick Mann rm...@latencyzero.com wrote: I'm trying to set my webapp up on a new server, and running into something I've never seen before. Google has solutions for people that worked, but none of them work for me. The same config on OpenSolaris and OS X work (albeit with different versions of MySQL and Resin). I'm not sure if this is new with 4.0.18 or not. I have MySQL and Resin 4.0.18 running on the same host. I have my Java webapp, and WordPress both installed. Whenever either one tries to access the DB, access is refused. Each webapp uses its own user/password. I've verified that I can access MySQL via the mysql command-line client using both sets of credentials. WordPress reports this error: /lz/usr/wordpress/wp-includes/wp-db.php:509: Warning: A link to the server could not be established. url=jdbc:mysql://localhost:3306/?characterEncoding=ISO8859_1 driver=com.mysql.jdbc.Driver com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. [mysql_error] MySQL: 5.5.12 Connector/J: 5.1.15 Resin: 4.0.18 OS: 4.4.3-4ubuntu5 My Java app reports Connection refused (long stacktrace follows). The MySQL JDBC connector is in webapp-jars. The config for the Java webapp looks like: database jndi-namejdbc/mydb/jndi-name max-connections1024/max-connections max-idle-time30s/max-idle-time driver typecom.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource/type urljdbc:mysql://localhost:3306/mydb/url usermydb/user password#/password /driver /database WordPress config: define('DB_NAME', 'wordpress'); define('DB_USER', 'wordpress'); define('DB_PASSWORD', ''); define('DB_HOST', 'localhost'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); Webapp error: java.net.ConnectException: Connection refused javax.servlet.ServletException: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) at javax.servlet.http.HttpServlet.service(HttpServlet.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:96) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109) at com.latencyzero.satdb.RequestFilter.doFilter(RequestFilter.java:124) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.latencyzero.satdb.SecurityFilter.doFilter(SecurityFilter.java:228) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156) at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:287) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:792) at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:730) at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:689) at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:669) at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:617) at com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:104) at