That fixed the issue! 

THANKS!!




Weerawit Maneepongsawat wrote:
> 
> IMO, This is not a good way to getSession from HibernateDaoSupport,
> Can you try something like
> 
> getHibernateTemplate().executeFind(new HibernateCallback() {
> 
>    public Object
> <http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true>
> *doInHibernate<file:///D:/API/Spring%20Framework%20API%202.5/docs/api/org/springframework/orm/hibernate3/HibernateCallback.html#doInHibernate%28org.hibernate.Session%29>
> *(Session<http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Session.html?is-external=true>
>  session) {
> //       your code hrere
> 
>          session.createSQLQuery("select ........");
>          return list;
>    }
> 
> });
> 
> Hope this help.
> Br,
> Weerawit Maneepongsawat
> On Thu, Feb 19, 2009 at 12:05 PM, ashan <arthan...@gmail.com> wrote:
> 
>>
>> after setting removeAbandoned to true it logged the stack that is helped
>> me
>> to isolate the code.
>>
>>    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
>> destroy-method="close">
>>        <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>        <property name="url" value="${jdbc.url}"/>
>>        <property name="username" value="${jdbc.username}"/>
>>        <property name="password" value="${jdbc.password}"/>
>>        <property name="maxActive" value="10"/>
>>         <property name="maxWait" value="30"/>
>>        <property name="removeAbandoned" value="true"/>
>>        <property name="removeAbandonedTimeout" value="10"/>
>>        <property name="logAbandoned" value="true"/>
>>         <property name="poolPreparedStatements" value="true"/>
>>        <property name="defaultAutoCommit" value="true"/>
>>    </bean>
>>
>>
>> Here is what the app code is doing.
>>
>> public class MyDaoHibernate extends HibernateDaoSupport
>> public List myMethod(String user) {
>>
>>                Query query = getSession().createSQLQuery("select
>> ........");
>>                List list = query.setCacheable(false).list();
>>
>>                 return list;
>> }
>>
>>
>> The DBCP pool complained that this code borrowed a connection and did not
>> return.
>>
>> Should we close any here?
>>
>> Thanks,
>> Shan
>>
>>
>>
>>
>>
>> ashan wrote:
>> >
>> > Matt,
>> > I'm using
>> > MySQL version 5.0.24-community-nt
>> > Driver: mysql-connector-java-5.0.5.jar
>> >
>> > Thanks
>> > Shan
>> >
>> >
>> >
>> > mraible wrote:
>> >>
>> >> What database/version and jdbc-driver/version are you using?
>> >>
>> >> Matt
>> >>
>> >> On Wed, Feb 18, 2009 at 9:14 PM, ashan <arthan...@gmail.com> wrote:
>> >>
>> >>>
>> >>> Hi,
>> >>>
>> >>>
>> >>> I'm using appfuse 2.x.
>> >>>
>> >>> I'm getting connection pool exhausted error after a  few logins. I
>> was
>> >>> simply logging out and logging in with a single browser.
>> >>>
>> >>> My applicationContext-resources.xml has the following:
>> >>>
>> >>>    <bean id="dataSource"
>> class="org.apache.commons.dbcp.BasicDataSource"
>> >>> destroy-method="close">
>> >>>        <property name="driverClassName"
>> >>> value="${jdbc.driverClassName}"/>
>> >>>        <property name="url" value="${jdbc.url}"/>
>> >>>        <property name="username" value="${jdbc.username}"/>
>> >>>        <property name="password" value="${jdbc.password}"/>
>> >>>        <property name="maxActive" value="10"/>
>> >>>        <property name="maxWait" value="60"/>
>> >>>        <property name="poolPreparedStatements" value="true"/>
>> >>>        <property name="defaultAutoCommit" value="true"/>
>> >>>    </bean>
>> >>>
>> >>> My web.xml has the following:
>> >>>
>> >>>    <session-config>
>> >>>        <session-timeout>30</session-timeout>
>> >>>    </session-config>
>> >>>
>> >>>
>> >>> I have also tried c3p0 as as suggested in one of the thread. When I
>> use
>> >>> this, after after a  few logins, the browser just hangs (apparently
>> >>> server
>> >>> is waiting for more connection).
>> >>>
>> >>> Is this because leaking hibernate sessions? What is the hibernate
>> >>> session
>> >>> closing policy? and where this is specified?
>> >>>
>> >>> Please help! Thanks in advance!!
>> >>>
>> >>>
>> >>> Environment:
>> >>> -------------
>> >>>
>> >>> Windows, Tomcat 6, appfuse.version-2.0.2, spring.version-2.5.4
>> >>>
>> >>>
>> >>> BTW I was able to reproduce the same in jetty as well.
>> >>>
>> >>>
>> >>> Shan
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> View this message in context:
>> >>>
>> http://www.nabble.com/connection-pool-exhausted-error-tp22093714s2369p22093714.html
>> >>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
>> >>> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/connection-pool-exhausted-error-tp22093714s2369p22094090.html
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
>> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>>
>>
> 
> 
> -- 
> Weerawit (Ty)
> 
> 

-- 
View this message in context: 
http://www.nabble.com/connection-pool-exhausted-error-tp22093714s2369p22100709.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to