2 Replies Latest reply on Aug 4, 2010 10:51 AM by Dean Hiller

    anyone using c3p0 with seam???

    Dean Hiller Expert

      I was trying out c3p0 with tomcat and seam, and c3p0's testConnectionOnCheckout so it behaves like jboss but on taking the database down and hitting any page in seam, seam ends up in infinite redirect with IE (with firefox, firefox had the smarts to break the redirect after 15 tries or so and say it detected a redirect).


      This is really bad if the database goes down and then the server is nailed as all your users who hit one page go into infinite redirect.


      I notice that in any connection pools, testConnectionOnCheckout causes these seam infinite redirects(jboss pool did the same thing to me on another project).


      Any ideas how to work around this?  I just want the same hack I used on jboss project....redirect to error.jsp and don't use error.xhtml at all so it ends up in JSF instead of seam.


      The exact log I keep seeing is these over and over....(NOTICE there is no exception for me to redirect on or I could fix this with the hack I had last time).  THANKS for any ideas you can give me.


      May 24, 2010 11:21:14 PM org.hibernate.util.JDBCExceptionReporter logExceptions
      WARNING: [mainapp][s:72EC56,r:3]SQL Error: 0, SQLState: null
      May 24, 2010 11:21:14 PM org.hibernate.util.JDBCExceptionReporter logExceptions
      SEVERE: [mainapp][s:72EC56,r:3]An attempt by a client to checkout a Connection has timed out.
      May 24, 2010 11:21:14 PM org.exadel.jsf.PhaseTracker beforePhase
      INFO: [mainapp][s:72EC56,r:3]BEFORE RENDER_RESPONSE 6
      May 24, 2010 11:21:14 PM org.exadel.jsf.PhaseTracker afterPhase
      INFO: [mainapp][s:72EC56,r:3]AFTER RENDER_RESPONSE 6
      May 24, 2010 11:21:14 PM com.alvazan.logging.FilterLogHttpRequest doFilter
      INFO: [mainapp][s:72EC56,r:3][time(ms):2122] url=http://dev.alvazan.com:8081/mainapp/web/debug.xhtml
      May 24, 2010 11:21:14 PM com.alvazan.logging.FilterLogHttpRequest doFilter
      INFO: [mainapp][s:72EC56,r:4]url=http://dev.alvazan.com:8081/mainapp/web/debug.xhtml params={cid=2,}
      May 24, 2010 11:21:14 PM org.exadel.jsf.PhaseTracker beforePhase
      INFO: [mainapp][s:72EC56,r:4]BEFORE RESTORE_VIEW 1
      May 24, 2010 11:21:14 PM org.exadel.jsf.PhaseTracker afterPhase
      INFO: [mainapp][s:72EC56,r:4]AFTER RESTORE_VIEW 1
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/jboss-seam-mail.jar!/META-INF/seam-mail.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/jboss-seam-pdf.jar!/META-INF/seam-pdf.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/jboss-seam-ui.jar!/META-INF/s.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/richfaces-ui.jar!/META-INF/a4j.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/richfaces-ui.jar!/META-INF/ajax4jsf.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/xsoftware/tomcat6ForDev/shared/lib/richfaces-ui.jar!/META-INF/jsp.taglib.xml
      May 24, 2010 11:21:15 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: [mainapp][s:72EC56,r:4]Added Library from: jar:file:/C:/AAROOT/areas/x
      



        • 1. Re: anyone using c3p0 with seam???
          joao massan Newbie

          I have the same problem. Did anyone get this working?

          • 2. Re: anyone using c3p0 with seam???
            Dean Hiller Expert

            I got it semi-working where most scenarios work. I can't remember though I remember there is one test that still fails(but it is more a low priority test).  I was told by the c3p0 developer that c3p0 by default will check after failures which is the best of all worlds....checks don't cause a performance hit until there is an exception and once there is an exception, it does a check/ping to see if it is database outage or just a bug in your software/db constraints.


            Here is my final settings that I use now...




                     <property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"/>
                     <property name="hibernate.c3p0.preferredTestQuery" value="select 1"/>
                     <property name="hibernate.c3p0.max_size" value="20"/>
                     <property name="hibernate.c3p0.min_size" value="5"/>
                     <property name="hibernate.c3p0.acquireRetryAttempts" value="0"/>
                     <property name="hibernate.c3p0.acquireRetryDelay" value="10000"/>