Exception on Mysql Connection

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Exception on Mysql Connection

John Arevalo
Hi list,

Im working with EclipseLink in Glassfish V2 server, connections are
created through MySQL pool in JAS. After several request to my web
Application ana exception is thrown with Error 500 response:

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
No operations allowed after connection closed.Connection was
implicitly closed due to underlying exception/error:

(Attachment StackTrace)

When I test my Connection pool with "Ping tool" in Server Admin
Console: "Ping Succeeded". Looks like Eclipse link isn't renew DB
Connection using pool.

(Attachment persistence.xml)

Thanks for your comments in order to fix this problem.

Regards,
--
John Arévalo
GNU/Linux User #443701
http://counter.li.org/

_______________________________________________
eclipselink-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

stacktrace.txt (11K) Download Attachment
persistence.xml (930 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Exception on Mysql Connection

jamesssss
You are using a JTA DataSource, so EclipseLink does not control the connection.  It will get a new connection from the DataSource for each request/transaction.  Somehow you seem to have a dead connection in your DataSource.

From the error it looks like you may have received an earlier exception before this one that caused your connection to be closed, perhaps set logging to finest and include the log.

You could also try using EclipseLink's connection pool instead of the DataSource, to confirm the issue is with the DataSource.


john arevalo wrote
Hi list,

Im working with EclipseLink in Glassfish V2 server, connections are
created through MySQL pool in JAS. After several request to my web
Application ana exception is thrown with Error 500 response:

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
No operations allowed after connection closed.Connection was
implicitly closed due to underlying exception/error:

(Attachment StackTrace)

When I test my Connection pool with "Ping tool" in Server Admin
Console: "Ping Succeeded". Looks like Eclipse link isn't renew DB
Connection using pool.

(Attachment persistence.xml)

Thanks for your comments in order to fix this problem.

Regards,
--
John Arévalo
GNU/Linux User #443701
http://counter.li.org/

** BEGIN NESTED EXCEPTION **

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
MESSAGE: Communications link failure

Last packet sent to the server was 0 ms ago.

STACKTRACE:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications
link failure

Last packet sent to the server was 0 ms ago.
        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:406)
        at
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2873)
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2763)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3299)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
        at
com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
        at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
        at
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1888)
        at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:846)
        at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:572)
        at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:500)
        at
org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:522)
        at
org.eclipse.persistence.internal.sessions.IsolatedClientSession.executeCall(IsolatedClientSession.java:134)
        at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:204)
        at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:190)
        at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:261)
        at
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:594)
        at
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2506)
        at
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2464)
        at
org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:478)
        at
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:879)
        at
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:666)
        at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:840)
        at
org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:456)
        at
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:902)
        at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2587)
        at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1178)
        at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1162)
        at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1136)
        at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1118)
        at
org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:399)
        at
org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:517)
        at
net.cable.check.gerencia.servlet.IndexServlet.processRequest(IndexServlet.java:51)
        at
net.cable.check.gerencia.servlet.BaseServlet.preRequest(BaseServlet.java:63)
        at
net.cable.check.gerencia.servlet.BaseServlet.doGet(BaseServlet.java:46)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at
org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:855)
        at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
        at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:542)
        at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:474)
        at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366)
        at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:767)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java from :66)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at
net.cable.check.gerencia.filter.LoginFilter.doFilter(LoginFilter.java:39)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at
net.cable.check.gerencia.filter.EncodingFilter.doFilter(EncodingFilter.java:39)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: java.io.EOFException: Can not read response from server.
Expected to read 4 bytes, read 0 bytes before connection was
unexpectedly lost.
        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2332)
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2774)
        ... 84 more


** END NESTED EXCEPTION **

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="reportesPU" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>check_new</jta-data-source>
    <properties>
      <property name="eclipselink.cache.shared.default" value="false"/>
      <property name="eclipselink.logging.level" value="fine"/>
    </properties>
  </persistence-unit>
</persistence>
Reply | Threaded
Open this post in threaded view
|

Re: Exception on Mysql Connection

John Arevalo
2008/9/22 James Sutherland <[hidden email]>:

>
> You are using a JTA DataSource, so EclipseLink does not control the
> connection.  It will get a new connection from the DataSource for each
> request/transaction.  Somehow you seem to have a dead connection in your
> DataSource.
>
> >From the error it looks like you may have received an earlier exception
> before this one that caused your connection to be closed, perhaps set
> logging to finest and include the log.
>
> You could also try using EclipseLink's connection pool instead of the
> DataSource, to confirm the issue is with the DataSource.
>
>
>

Exception didn't appear again after setting in my.cnf
interactive_timeout = 28800
wait_timeout = 28800

mysql idle timeout was closing connections.

do you know how can i setting in Glassfish pool "auto-reconnect"?

PD: in pool properties i've setting this properties, but didn't take effect:
<property name="autoReconnectForPools" value="true"/>
<property name="autoReconnect" value="true"/>

Best Regards,

--
John Arévalo
GNU/Linux User #443701
http://counter.li.org/
_______________________________________________
eclipselink-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/eclipselink-users