You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Bruno René Santos <br...@holos.pt> on 2010/10/28 11:59:58 UTC

MySQL error - connection reset

Hello all,

Yesterday I left an application running with cayenne on a tomcat server (left
the browser opened), using JNDI, and when I came today and tried to use it again
I got the error in attachment. It seems mysql resetted the connection with
cayenne during the night. One of the things that made me choose Cayenne over
Hibernate was under the assumption that connections were made with the database
server only when needed (on performQuery or commitChanges) but on this situation
it seemed that the connection was permanently opened and cayenne tried to use it
again (like hibernate). 

Perhaps I am doing something wrong and so I needed some clarification on this
issue.

 

Thank you

Bruno Santos


Re: MySQL error - connection reset

Posted by Borut Bolčina <bo...@gmail.com>.
Hi,

if you are using dbcp.properties, do you have something like

cayenne.dbcp.validationQuery="SELECT 1 FROM one_of_your_table"

-Borut

2010/10/28 Bruno René Santos <br...@holos.pt>

>   Hello all,
>
> Yesterday I left an application running with cayenne on a tomcat server
> (left the browser opened), using JNDI, and when I came today and tried to
> use it again I got the error in attachment. It seems mysql resetted the
> connection with cayenne during the night. One of the things that made me
> choose Cayenne over Hibernate was under the assumption that connections were
> made with the database server only when needed (on performQuery or
> commitChanges) but on this situation it seemed that the connection was
> permanently opened and cayenne tried to use it again (like hibernate).
>
> Perhaps I am doing something wrong and so I needed some clarification on
> this issue.
>
>
>
> Thank you
>
> Bruno Santos
>

RE: MySQL error - connection reset

Posted by Bruno René Santos <br...@holos.pt>.
Also I am using tomcat 6.0.26 with liferay.

Thanx
Bruno

-----Mensagem original-----
De: Bruno René Santos [mailto:brunorene@holos.pt] 
Enviada: quinta-feira, 28 de Outubro de 2010 14:47
Para: user@cayenne.apache.org
Assunto: RE: MySQL error - connection reset

Hi Michael,

I am using cayenne 3.0.1 and I create a datacontext with
DataContext.createDataContext(), using a JNDI connection pool configured on the
context.xml on tomcat.

Thanx
Bruno

-----Mensagem original-----
De: Michael Gentry [mailto:mgentry@masslight.net] 
Enviada: quinta-feira, 28 de Outubro de 2010 14:23
Para: user@cayenne.apache.org
Assunto: Re: MySQL error - connection reset

Hi Bruno,

Are you using Cayenne's connection pooling mechanism or something
provided by the container?  Either should automatically reconnect for
you.

mrg

On Thu, Oct 28, 2010 at 5:59 AM, Bruno René Santos <br...@holos.pt> wrote:
> Hello all,
>
> Yesterday I left an application running with cayenne on a tomcat server
> (left the browser opened), using JNDI, and when I came today and tried to
> use it again I got the error in attachment. It seems mysql resetted the
> connection with cayenne during the night. One of the things that made me
> choose Cayenne over Hibernate was under the assumption that connections were
> made with the database server only when needed (on performQuery or
> commitChanges) but on this situation it seemed that the connection was
> permanently opened and cayenne tried to use it again (like hibernate).
>
> Perhaps I am doing something wrong and so I needed some clarification on
> this issue.
>
>
>
> Thank you
>
> Bruno Santos



RE: MySQL error - connection reset

Posted by Bruno René Santos <br...@holos.pt>.
Hi Michael,

I am using cayenne 3.0.1 and I create a datacontext with
DataContext.createDataContext(), using a JNDI connection pool configured on the
context.xml on tomcat.

Thanx
Bruno

-----Mensagem original-----
De: Michael Gentry [mailto:mgentry@masslight.net] 
Enviada: quinta-feira, 28 de Outubro de 2010 14:23
Para: user@cayenne.apache.org
Assunto: Re: MySQL error - connection reset

Hi Bruno,

Are you using Cayenne's connection pooling mechanism or something
provided by the container?  Either should automatically reconnect for
you.

mrg

On Thu, Oct 28, 2010 at 5:59 AM, Bruno René Santos <br...@holos.pt> wrote:
> Hello all,
>
> Yesterday I left an application running with cayenne on a tomcat server
> (left the browser opened), using JNDI, and when I came today and tried to
> use it again I got the error in attachment. It seems mysql resetted the
> connection with cayenne during the night. One of the things that made me
> choose Cayenne over Hibernate was under the assumption that connections were
> made with the database server only when needed (on performQuery or
> commitChanges) but on this situation it seemed that the connection was
> permanently opened and cayenne tried to use it again (like hibernate).
>
> Perhaps I am doing something wrong and so I needed some clarification on
> this issue.
>
>
>
> Thank you
>
> Bruno Santos


Re: MySQL error - connection reset

Posted by Michael Gentry <mg...@masslight.net>.
Hi Bruno,

Are you using Cayenne's connection pooling mechanism or something
provided by the container?  Either should automatically reconnect for
you.

mrg

On Thu, Oct 28, 2010 at 5:59 AM, Bruno René Santos <br...@holos.pt> wrote:
> Hello all,
>
> Yesterday I left an application running with cayenne on a tomcat server
> (left the browser opened), using JNDI, and when I came today and tried to
> use it again I got the error in attachment. It seems mysql resetted the
> connection with cayenne during the night. One of the things that made me
> choose Cayenne over Hibernate was under the assumption that connections were
> made with the database server only when needed (on performQuery or
> commitChanges) but on this situation it seemed that the connection was
> permanently opened and cayenne tried to use it again (like hibernate).
>
> Perhaps I am doing something wrong and so I needed some clarification on
> this issue.
>
>
>
> Thank you
>
> Bruno Santos

Re: MySQL error - connection reset

Posted by Andrus Adamchik <an...@objectstyle.org>.
It was for the users of org.apache.cayenne.conf.WebApplicationContextFilter. If an app bootstraps Cayenne on its own, I would suggest emulating this filter's "destroy" method in an appropriate servlet or filter:

   public void destroy() {
       Configuration config = Configuration.getSharedConfiguration();
       if (config != null) {
           config.shutdown();
       }
   }

Andrus


On Oct 28, 2010, at 4:23 PM, Michael Gentry wrote:

> I believe this was fixed in 3.0.1.
> 
> On Thu, Oct 28, 2010 at 7:31 AM, Bruno René Santos <br...@holos.pt> wrote:
>> Also when i undeploy a portlet with cayenne embedded on it i get the error
>> 
>> SEVERE: A web application appears to have started a thread named
>> [cayenne-edt-2855942-4] but has failed to stop it. This is very likely to create
>> a memory leak.
>> 
>> 28/Out/2010 12:29:56 org.apache.catalina.loader.WebappClassLoader
>> clearReferencesThreads
>> 
>> Several times, which also means, I think, that the connection is on.
>> 
>> 
>> 
>> Thanx
>> 
>> 


Re: MySQL error - connection reset

Posted by Michael Gentry <mg...@masslight.net>.
I believe this was fixed in 3.0.1.

On Thu, Oct 28, 2010 at 7:31 AM, Bruno René Santos <br...@holos.pt> wrote:
> Also when i undeploy a portlet with cayenne embedded on it i get the error
>
> SEVERE: A web application appears to have started a thread named
> [cayenne-edt-2855942-4] but has failed to stop it. This is very likely to create
> a memory leak.
>
> 28/Out/2010 12:29:56 org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
>
> Several times, which also means, I think, that the connection is on.
>
>
>
> Thanx
>
>
>
> De: Bruno René Santos [mailto:brunorene@holos.pt]
> Enviada: quinta-feira, 28 de Outubro de 2010 11:00
> Para: user@cayenne.apache.org
> Assunto: MySQL error - connection reset
>
>
>
> Hello all,
>
> Yesterday I left an application running with cayenne on a tomcat server (left
> the browser opened), using JNDI, and when I came today and tried to use it again
> I got the error in attachment. It seems mysql resetted the connection with
> cayenne during the night. One of the things that made me choose Cayenne over
> Hibernate was under the assumption that connections were made with the database
> server only when needed (on performQuery or commitChanges) but on this situation
> it seemed that the connection was permanently opened and cayenne tried to use it
> again (like hibernate).
>
> Perhaps I am doing something wrong and so I needed some clarification on this
> issue.
>
>
>
> Thank you
>
> Bruno Santos
>
>

RE: MySQL error - connection reset

Posted by Bruno René Santos <br...@holos.pt>.
Also when i undeploy a portlet with cayenne embedded on it i get the error

SEVERE: A web application appears to have started a thread named
[cayenne-edt-2855942-4] but has failed to stop it. This is very likely to create
a memory leak.

28/Out/2010 12:29:56 org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads

Several times, which also means, I think, that the connection is on.

 

Thanx

 

De: Bruno René Santos [mailto:brunorene@holos.pt] 
Enviada: quinta-feira, 28 de Outubro de 2010 11:00
Para: user@cayenne.apache.org
Assunto: MySQL error - connection reset

 

Hello all,

Yesterday I left an application running with cayenne on a tomcat server (left
the browser opened), using JNDI, and when I came today and tried to use it again
I got the error in attachment. It seems mysql resetted the connection with
cayenne during the night. One of the things that made me choose Cayenne over
Hibernate was under the assumption that connections were made with the database
server only when needed (on performQuery or commitChanges) but on this situation
it seemed that the connection was permanently opened and cayenne tried to use it
again (like hibernate). 

Perhaps I am doing something wrong and so I needed some clarification on this
issue.

 

Thank you

Bruno Santos