title: problem with EJB 3
body: <p>I have problem with EJB,i can do normally when current day , and i try change to next 2 day it means current is 9--> 11 . And do somewhere on JSF page such as click on one link or comment one post. . .
  if current day it work well, but next 2 day . Server log print</p>
  
  <pre><code>INFO: Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query.
  </code></pre>
  
  <p>and after that it throw a long stracktrace such as:</p>
  
  <pre><code>WARNING: Local Exception Stack: 
  Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.DatabaseException
  Internal Exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  The last packet successfully received from the server was 259,224,647 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
  Error Code: 0
  Call: SELECT itemid, item_name, item_describe, status, img, toprent, author, price, dateexp, item_detail, instock, fine, cat_id FROM item
  Query: ReadAllQuery(name="Items.findAll" referenceClass=Items sql="SELECT itemid, item_name, item_describe, status, img, toprent, author, price, dateexp, item_detail, instock, fine, cat_id FROM item")
          at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
          at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1422)
          at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:679)
          at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:530)
          at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:529)
          at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205)
          at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:191)
          at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:262)
          at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:618)
          at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2537)
          at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2496)
          at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:455)
          at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:997)
          at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:675)
          at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
          at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:432)
          at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
          at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2857)
          at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
          at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1299)
          at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1299)
          at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1299)
          at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1299)
          at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
          at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181)
          at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:453)
          at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:681)
          at com.DAO.ItemDAO.retrieveAllItem(ItemDAO.java:43)
          at sun.reflect.GeneratedMethodAccessor129.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
          at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
          at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5292)
          at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
          at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
          at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
          at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
          at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
          at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
          at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
          at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
          at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5264)
          at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252)
          at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
          at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
          at $Proxy141.retrieveAllItem(Unknown Source)
          at com.DAO.__EJB31_Generated__ItemDAO__Intf____Bean__.retrieveAllItem(Unknown Source)
          at com.mcgraw.controller.ItemController.getAllItem(ItemController.java:49)
          at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
          at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
          at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
          at com.sun.el.parser.AstValue.getValue(AstValue.java:116)
          at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
          at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
          at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:102)
          at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
          at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178)
          at javax.faces.component.UIData.getValue(UIData.java:554)
          at javax.faces.component.UIData.getDataModel(UIData.java:1248)
          at javax.faces.component.UIData.setRowIndex(UIData.java:447)
          at org.primefaces.component.datagrid.DataGridRenderer.encodeTable(DataGridRenderer.java:156)
          at org.primefaces.component.datagrid.DataGridRenderer.encodeMarkup(DataGridRenderer.java:76)
          at org.primefaces.component.datagrid.DataGridRenderer.encodeEnd(DataGridRenderer.java:52)
          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1620)
          at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
          at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
          at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
          at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:157)
          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
          at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
          at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:113)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
          at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:820)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
          at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:517)
          at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:488)
          at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:379)
          at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:336)
          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:314)
          at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:104)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
          at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
          at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
          at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
          at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
          at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
          at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
          at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
          at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
          at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
          at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
          at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
          at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
          at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
          at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
          at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
          at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
          at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
          at java.lang.Thread.run(Thread.java:619)
  Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  The last packet successfully received from the server was 259,224,647 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds 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:409)
          at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118)
          at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3055)
          at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2941)
          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3489)
          at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
          at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
          at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
          at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
          at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275)
          at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:892)
          at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:602)
          ... 120 more
  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:2502)
          at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2952)
          ... 129 more
  </code></pre>
  
  <p>i don't know why error occur, any body please help me !!!</p>
  
  <p>Thank you</p>