Hi Paul,
Thanks for pointing this. I am new to this Pool connection concept.
I have used mysql before and never had this timeout problem as I always close
the connection right away.
After googling a couple of hours and I am still not sure how to set
"testOnBorrow = true" in Axis.
I am using stand alone Axis2. Most pages talks about how to set it up in
tomcat, etc.
So I set it like the following:
getConnection("jdbc:mysql://localhost:3306/AndroidAuto?autoReconnect=true&testOnBorrow=true")
In public class DBServiceLifeCycle implements ServiceLifeCycle's startup method.
Is this the correct way to set this up?
Thanks,
-ted
On 12/12/11 1:45 AM, "Hodchenkov, Paul" <[email protected]> wrote:
Hi Ted,
autoReconnect=true is not a proper solution: mysql close the connection if it
was idle for 2 hours. So if you access the closed connection you will have
exception first and then auto reconnect, but
the original request will fail. You need to setup 'autoreconnect+connection
test on borrow' at the pool level...
From: Ted Zeng [mailto:[email protected]]
Sent: Monday, December 12, 2011 11:39 AM
To: [email protected]
Subject: Re: Question about MySQL timeout problem
It looks like I fixed this problem with setting
autoReconnect=true
In DriverManager.getConnection() in the ServiceLifeCycle code.
I am using connection pool. I am pretty much following the Example code
(DBService).
It seems the sample code should add "autoReconnect=true" to it. As the code
stands now,
It should fail eventually when the database connection times out.
Thanks,
-ted
On 12/11/11 10:59 PM, "Hodchenkov, Paul" <[email protected]> wrote:
Use connection pool in axis2 service (c3p0 for example)
From: Ted Zeng [mailto:[email protected]]
Sent: Friday, December 09, 2011 11:24 PM
To: [email protected]
Subject: Question about MySQL timeout problem
Hi all,
After my app. Runs ok with Axis2 for a while, I get the following exception on
Axis2 and Axis is stuck.
My app. Could not talk to Axis anymore. If I reboot Axis2, then everything
works again.
I google this and found out most are reported by Hibernate users and their
solutions.
How should I resolve this? Is there a setting for Axis2 I need to set.
-Ted Zeng
Adobe Systems Inc.
---------------
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet
successfully received from the server was 39,903,899 milliseconds ago. The
last packet sent successfully to the server was 39,903,899 milliseconds ago. is
longer than the server configured value of 'wait_timeout'. You should consider
either expiring and/or testing connection validity before use in your
application, increasing the server configured values for client timeouts, or
using the Connector/J connection property 'autoReconnect=true' to avoid this
problem.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3364)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1983)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)
at db.AndroidAutoService.insertDevice(AndroidAutoService.java:102)
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:597)
at
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at
org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:66)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:296)
at
org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
at
org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
at
org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3345)