You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by fdehghani <de...@yahoo.com> on 2007/09/22 11:31:04 UTC

tomcat can not connect to MySql

I ues Appache tomcat as my App Server in my project
but when running its service, after sometime when run my project,tomcat say
that can not connect to database(SystemException)
then i should restart its service to work correctly.
i'm not sure thet its tomcat's problem or MySql
please help me.
-- 
View this message in context: http://www.nabble.com/tomcat-can-not-connect-to-MySql-tf4500426.html#a12834957
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat can not connect to MySql

Posted by David Smith <dn...@cornell.edu>.
This stack trace seems short and unusually terse.  I can guess this is 
Sun JDK 1.4 since javax.transaction.SystemException doesn't exist in 
later JDKs.  Since the exception is thrown by 
com.met.data.factory.user.UserFactory, is this class one of yours?  If 
so, it would be great if you could add logging where this exception is 
thrown to shed some light on the root cause.  You could even add it as a 
String in the exception's constructor.

--David

fdehghani wrote:
> also i have to say that i use hibernate 3 to connect to Mysql 
>
> thanks for your attention
>
> -- Fatemeh
>
>
> fdehghani wrote:
>   
>> Tomcat 5.5.9
>> OS Windows Server 2003 , Windows XP
>> Mysql 5.0
>> tomcat and mysql on the same server
>>
>> javax.transaction.SystemException
>> 	com.met.data.factory.user.UserFactory.getUser(UserFactory.java:694)
>> 	com.met.action.LoginAction.execute(LoginAction.java:56)
>>
>> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
>>
>> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
>> 	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
>> 	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>> 	com.met.filter.CharsetFilter.doFilter(CharsetFilter.java:31)
>>
>> any connection closed after open it
>>
>> -- Fatemeh
>>
>>
>> David Smith-2 wrote:
>>     
>>> Can you provide some specifics of your environment?
>>>
>>> Tomcat version
>>> OS
>>> Mysql version (both driver and server)
>>> Both tomcat and mysql on the same machine?
>>> If not, any firewalls that might be timing out a connection?
>>> How long does it run before it doesn't work?
>>> Can you post the full stack trace of your exception including root cause?
>>> In your design, are you holding on to connections or closing them as 
>>> soon as you are done talking to the db?
>>>
>>> Mysql server does timeout connections after 8 hours by default.  If you 
>>> are using tomcat's database pooling, this can be fixed with the simple 
>>> addition of a validation query in the config.  In any case, it's best 
>>> practice for the code querying the db to close connections as soon as 
>>> reasonably possible and not keep them open.
>>>
>>> --David
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>       
>>     
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat can not connect to MySql

Posted by fdehghani <de...@yahoo.com>.
also i have to say that i use hibernate 3 to connect to Mysql 

thanks for your attention

-- Fatemeh


fdehghani wrote:
> 
> Tomcat 5.5.9
> OS Windows Server 2003 , Windows XP
> Mysql 5.0
> tomcat and mysql on the same server
> 
> javax.transaction.SystemException
> 	com.met.data.factory.user.UserFactory.getUser(UserFactory.java:694)
> 	com.met.action.LoginAction.execute(LoginAction.java:56)
> 
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
> 
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
> 	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
> 	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 	com.met.filter.CharsetFilter.doFilter(CharsetFilter.java:31)
> 
> any connection closed after open it
> 
> -- Fatemeh
> 
> 
> David Smith-2 wrote:
>> 
>> Can you provide some specifics of your environment?
>> 
>> Tomcat version
>> OS
>> Mysql version (both driver and server)
>> Both tomcat and mysql on the same machine?
>> If not, any firewalls that might be timing out a connection?
>> How long does it run before it doesn't work?
>> Can you post the full stack trace of your exception including root cause?
>> In your design, are you holding on to connections or closing them as 
>> soon as you are done talking to the db?
>> 
>> Mysql server does timeout connections after 8 hours by default.  If you 
>> are using tomcat's database pooling, this can be fixed with the simple 
>> addition of a validation query in the config.  In any case, it's best 
>> practice for the code querying the db to close connections as soon as 
>> reasonably possible and not keep them open.
>> 
>> --David
>> 
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/tomcat-can-not-connect-to-MySql-tf4500426.html#a12845323
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat can not connect to MySql

Posted by fdehghani <de...@yahoo.com>.
Tomcat 5.5.9
OS Windows Server 2003 , Windows XP
Mysql 5.0
tomcat and mysql on the same server

javax.transaction.SystemException
	com.met.data.factory.user.UserFactory.getUser(UserFactory.java:694)
	com.met.action.LoginAction.execute(LoginAction.java:56)

org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	com.met.filter.CharsetFilter.doFilter(CharsetFilter.java:31)

any connection closed after open it

-- Fatemeh


David Smith-2 wrote:
> 
> Can you provide some specifics of your environment?
> 
> Tomcat version
> OS
> Mysql version (both driver and server)
> Both tomcat and mysql on the same machine?
> If not, any firewalls that might be timing out a connection?
> How long does it run before it doesn't work?
> Can you post the full stack trace of your exception including root cause?
> In your design, are you holding on to connections or closing them as 
> soon as you are done talking to the db?
> 
> Mysql server does timeout connections after 8 hours by default.  If you 
> are using tomcat's database pooling, this can be fixed with the simple 
> addition of a validation query in the config.  In any case, it's best 
> practice for the code querying the db to close connections as soon as 
> reasonably possible and not keep them open.
> 
> --David
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/tomcat-can-not-connect-to-MySql-tf4500426.html#a12843354
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat can not connect to MySql

Posted by David Smith <dn...@cornell.edu>.
Can you provide some specifics of your environment?

Tomcat version
OS
Mysql version (both driver and server)
Both tomcat and mysql on the same machine?
If not, any firewalls that might be timing out a connection?
How long does it run before it doesn't work?
Can you post the full stack trace of your exception including root cause?
In your design, are you holding on to connections or closing them as 
soon as you are done talking to the db?

Mysql server does timeout connections after 8 hours by default.  If you 
are using tomcat's database pooling, this can be fixed with the simple 
addition of a validation query in the config.  In any case, it's best 
practice for the code querying the db to close connections as soon as 
reasonably possible and not keep them open.

--David

fdehghani wrote:
> I ues Appache tomcat as my App Server in my project
> but when running its service, after sometime when run my project,tomcat say
> that can not connect to database(SystemException)
> then i should restart its service to work correctly.
> i'm not sure thet its tomcat's problem or MySql
> please help me.
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat can not connect to MySql

Posted by Hassan Schroeder <ha...@gmail.com>.
On 9/22/07, fdehghani <de...@yahoo.com> wrote:
>
> but when running its service, after sometime when run my project,tomcat say
> that can not connect to database(SystemException)
> then i should restart its service to work correctly.
> i'm not sure thet its tomcat's problem or MySql

If a TC restart "fixes" it, the problem is almost certainly your app :-)

Sounds like you're not closing connections somewhere. If you're
using connection pooling, set the pool size to 1 and you'll find the
problem pretty quickly...

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org