Don't use that ... it still throws an error, reconnecting only after the
exception is thrown.  If using the db pooling in tomcat, it's better to
include a validationQuery attribute in the <Resource ... /> element in
your app's context.xml file.  If on the other hand you are directly
connecting the database on your own then just trap the exception, open a
new connection and try again.

--David

On 5/30/2010 1:53 PM, Yucca Nel wrote:
> Ok I need to keep connection open to avoid exceeption but have found this is 
> deprecated ....
> autoReconnect=true
> can someone provide up to date strategy for dealing with this?
>
> --------------------------------------------------
> From: "Jeff" <jwi...@cox.net>
> Sent: Sunday, May 30, 2010 5:54 PM
> To: "Tomcat Users List" <users@tomcat.apache.org>
> Subject: Re: problems at thejarbar.org
>
>   
>> would this help?
>>
>> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems
>>
>>
>> On 5/30/2010 10:08 AM, Yucca Nel wrote:
>>     
>>> The following is becoming a common and serious problem and I am unable to 
>>> find a google solution for it...
>>> I have never seen sych an error and it does not appear to be common 
>>> enough to get many google hits but when it happens, no one is able to 
>>> register at my site...
>>>
>>> Stck trace:
>>>
>>> Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 
>>> Communications link failure
>>>
>>> The last packet successfully received from the server was 4,290,127 
>>> 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:406)
>>> at 
>>> com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
>>> at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3052)
>>> at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2938)
>>> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3481)
>>> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
>>> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
>>> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
>>> at 
>>> com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
>>> at 
>>> com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228)
>>> at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:550)
>>> ... 15 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:2497)
>>> at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2949)
>>> ... 23 more
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - 
>>> Communications link failure
>>>
>>> The last packet successfully received from the server was 4,299,820 
>>> milliseconds ago.  The last packet sent successfully to the server was 0 
>>> milliseconds ago.
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No 
>>> operations allowed after connection closed.Connection was implicitly 
>>> closed by the driver.
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No 
>>> operations allowed after connection closed.Connection was implicitly 
>>> closed by the driver.
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No 
>>> operations allowed after connection closed.Connection was implicitly 
>>> closed by the driver.
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No 
>>> operations allowed after connection closed.Connection was implicitly 
>>> closed by the driver.
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No 
>>> operations allowed after connection closed.Connection was implicitly 
>>> closed by the driver.
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No 
>>> operations allowed after connection closed.Connection was implicitly 
>>> closed by the driver.
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No 
>>> operations allowed after connection closed.Connection was implicitly 
>>> closed by the driver.
>>> ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No 
>>> operations allowed after connection closed.Connection was implicitly 
>>> closed by the driver.
>>> ERROR TP-Processor6 
>>> org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces
>>>  
>>> Servlet]The registration code that leads to error is as follows: 
>>> Form:<!--Created by IntelliJ IDEA.User: ownerDate: 02.mai.2010Time: 
>>> 14:07:31To change this template use File | Settings | File 
>>> Templates.--><%...@page contentType="text/html" language="java" 
>>> %><%...@page 
>>> pageEncoding="UTF-8"%><%...@taglib uri="http://java.sun.com/jsf/core"; 
>>> prefix="f" %><%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"; 
>>> %><html><head>     <meta http-equiv="Content-Type" content="text/html; 
>>> charset=UTF-8" />     <title>The jar bar:: 
>>> register</title></head><f:view>     <body 
>>> style="background-color:#7b68ee;margin:auto">     <div align="center"> 
>>> <div align="center" id="header"><jsp:include page="/header.jsp"/></div> 
>>> <div align="center" id="centred-content"style="border-width:3px; 
>>> border-style: solid; border-color: #7fffd4;width:800px">             <div 
>>> id="h1" align="center">                 <h:outputText 
>>> value="#{registerMsg.h1}" style="color:white; 
>>> font-family:fantasy;font-size:x-large;"/>                 <div id="p1" 
>>> align="center">                     <h:outputText 
>>> value="#{registerMsg.p1}" 
>>> style="font-size:large;margin-bottom:5em;color:white;"/> 
>>> <h:form>                     </h:form>                 </div> 
>>> <h:form>                     <h:panelGrid columns="2"> 
>>> <h:outputText value="*#{registerMsg.name}:" style="color:yellow;"/> 
>>> <h:inputText id="name" value="#{user.entity.firstName}" 
>>> title="#{registerMsg.nameTitle}"required="true"> 
>>> <f:validateLength minimum="3"maximum="30"/> 
>>> <h:message for="name"style="color:red;"/> 
>>> </h:inputText>                         <h:outputText 
>>> value="#{registerMsg.surname}:" style="color:yellow;"/> 
>>> <h:inputText id="surname" value="#{user.entity.lastName}" 
>>> title="#{registerMsg.surnameTitle}" required="false"> 
>>> <f:validateLength minimum="3"maximum="30"/> 
>>> <h:message for="surname" style="color:red;" /> 
>>> </h:inputText>                         <h:outputText 
>>> value="*#{registerMsg.email}:" style="color:yellow;"/> 
>>> <h:inputText id="email" value="#{user.entity.userEmail}" 
>>> title="#{registerMsg.emailTitle}"required="true"> 
>>> <f:validator validatorId="emailEValidate"/> 
>>> <f:validator validatorId="emailPValidate"/> 
>>> <h:message for="email" style="color:red;"/> 
>>> </h:inputText>                         <h:outputText 
>>> value="*#{registerMsg.userName}:" style="color:yellow;"/> 
>>> <h:inputText id="uName" value="#{user.entity.userName}" 
>>> title="#{registerMsg.userNameTitle}"required="true"> 
>>> <f:validator validatorId="uNameEValidate"/> 
>>> <f:validateLength maximum="20" minimum="6"/> 
>>> <h:message for="uName" style="color:red;"/></h:inputText> 
>>> <h:outputText value="*#{registerMsg.password}:" style="color:yellow;"/> 
>>> <h:inputSecret id="pass" value="#{user.entity.userPass}" 
>>> title="#{registerMsg.passwordTitle}*"required="true"> 
>>> <f:validateLength minimum="6"maximum="20" /> 
>>> <h:message for="pass" style="color:red;"/> 
>>> </h:inputSecret>                     </h:panelGrid> 
>>> <h:commandButton action="#{user.create}" 
>>> value="#{registerMsg.register}"style="color:#20b2aa;" /> 
>>> <br>                 </h:form>             </div>             <div 
>>> id="footer" align="center">                 <jsp:include 
>>> page="/Footer.jsp"/>             </div>         </div>     </div> 
>>> </body></f:view></html>    Anyone have any thoughts as to why this is 
>>> happening?
>>>
>>>
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com
>>> Version: 9.0.819 / Virus Database: 271.1.1/2904 - Release Date: 05/29/10 
>>> 13:25:00
>>>
>>>
>>>       
>>     
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to