Topic
3 replies Latest Post - ‏2013-02-08T00:03:53Z by SystemAdmin
SystemAdmin
SystemAdmin
2327 Posts
ACCEPTED ANSWER

Pinned topic SQL closed connection error

‏2013-01-31T16:23:55Z |
Hi,

We have Worklight Mobile Foundation Enterprise Edition Server 5.0.5 setup on WebSphere Application Server 8.5 as a production environment. There are a number of SQL adapters that connect to a MySQL database. We have noticed that after a few hours of inactivity, when the mobile client app tries to retrieve content from these adapters, we usually encounter the below error at the first attempt and the client receives an error message 'java.sql.SQLException: Already closed'. However, subsequent requests to these adapters work fine. Note that our MySQL DB server is running the entire time. Please advise.

=============================================
DataAccessSer E com.worklight.integration.services.impl.DataAccessServiceImpl callProcedure FWLSE0035E: Invocation of procedure
java.lang.RuntimeException: java.sql.SQLException: Already closed.
at com.worklight.adapters.sql.SQLConnectionManager.closeConnection(SQLConnectionManager.java:145)
at com.worklight.integration.model.ConnectionManager.closeConnection(ConnectionManager.java:78)
at com.worklight.integration.model.InvocationContext.call(InvocationContext.java:166)
at com.worklight.integration.model.InvocationContext.call(InvocationContext.java:34)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
at java.util.concurrent.FutureTask.run(FutureTask.java:149)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:770)
Caused by: java.sql.SQLException: Already closed.
at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:114)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:191)
at com.worklight.adapters.sql.SQLConnectionManager.closeConnection(SQLConnectionManager.java:143)
... 8 more
  • ShmulikB
    ShmulikB
    20 Posts
    ACCEPTED ANSWER

    Re: SQL closed connection error

    ‏2013-02-05T09:58:10Z  in response to SystemAdmin
    Can you please provide us more information?
    worklight.properties,
    MySQL JDBC driver version,
    any special configuration done to the mysql server in regards to timeouts.
    • SystemAdmin
      SystemAdmin
      2327 Posts
      ACCEPTED ANSWER

      Re: SQL closed connection error

      ‏2013-02-07T16:52:30Z  in response to ShmulikB
      I was able to resolve this by setting the wait_timeout parameter to a higher value in the MySQL configuration (default was 8 hours).
      However, I was looking for a possible setting at the worklight server end, which can refresh/recycle these connections, without having to keep the database server connection timeout as a high value. For the time being, I have not created a data source in the worklight.properties file. The SQL connection parameters are directly specified in the WL adapter XML file.
      MySQL driver - mysql-connector-java-5.1.22.jar
  • SystemAdmin
    SystemAdmin
    2327 Posts
    ACCEPTED ANSWER

    Re: SQL closed connection error

    ‏2013-02-08T00:03:53Z  in response to SystemAdmin
    Note: IBM forums are in the process of migrating to a new format. During migration the forums will be frozen and in read-only mode. If you wish to continue this thread discussion please post it on stackoverflow, where the Worklight team and others can respond.

    See the Forum Migration announce post for more details. Thank you.

    Barbara Hampson, Manager, IBM Worklight