6 Replies Latest reply on Nov 9, 2009 9:13 AM by Tasneem Bhyat

    Cannot open connection - urgent help please

    Tasneem Bhyat Newbie
      Hi

      We have an application that has been running fine all this time. Now that we are stress testing it, we seem to be having connection timeouts and the following problem when trying to retrieve over 500 records...

      javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
      11:29:40,859 INFO  [STDOUT] 11:29:40,859 ERROR [actionBean] EXCEPTION TRACE: BEGIN
      11:29:40,859 ERROR [STDERR]
      org.hibernate.exception.GenericJDBCException: Cannot open connection
      11:29:40,875 ERROR [STDERR]   at com.ericsson.mst.model.util.AbstractManagerBean.handleModelException(AbstractManagerBean.java:28)
      11:29:40,875 ERROR [STDERR]   at com.ericsson.mst.model.userAnswers.UserAnswersManagerBean.findByForeignKeysAnonUser(UserAnswersManagerBean.java:283)
      11:29:40,890 ERROR [STDERR]   at sun.reflect.GeneratedMethodAccessor344.invoke(Unknown Source)
      11:29:40,890 ERROR [STDERR]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:29:40,906 ERROR [STDERR]   at java.lang.reflect.Method.invoke(Method.java:597)
      11:29:40,906 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      11:29:40,906 ERROR [STDERR]   at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      11:29:40,921 ERROR [STDERR]   at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      11:29:40,921 ERROR [STDERR]   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      11:29:40,921 ERROR [STDERR]   at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      11:29:40,937 ERROR [STDERR]   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:29:40,937 ERROR [STDERR]   at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:43)
      11:29:40,953 ERROR [STDERR]   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:29:40,968 ERROR [STDERR]   at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      11:29:40,968 ERROR [STDERR]   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:29:40,968 ERROR [STDERR]   at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      11:29:40,984 ERROR [STDERR]   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:29:41,000 ERROR [STDERR]   at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
      11:29:41,000 ERROR [STDERR]   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:29:41,015 ERROR [STDERR]   at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
      11:29:41,015 ERROR [STDERR]   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:29:41,031 ERROR [STDERR]   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
      11:29:41,031 ERROR [STDERR]   at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      11:29:41,031 ERROR [STDERR]   at sun.reflect.GeneratedMethodAccessor141.invoke(Unknown Source)
      11:29:41,046 ERROR [STDERR]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:29:41,046 ERROR [STDERR]   at java.lang.reflect.Method.invoke(Method.java:597)
      11:29:41,046 ERROR [STDERR]   at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      11:29:41,062 ERROR [STDERR]   at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      11:29:41,062 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,062 ERROR [STDERR]   at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      11:29:41,078 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,078 ERROR [STDERR]   at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      11:29:41,078 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,093 ERROR [STDERR]   at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
      11:29:41,093 ERROR [STDERR]   at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      11:29:41,093 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,109 ERROR [STDERR]   at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
      11:29:41,109 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,109 ERROR [STDERR]   at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      11:29:41,125 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,125 ERROR [STDERR]   at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      11:29:41,125 ERROR [STDERR]   at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
      11:29:41,140 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,140 ERROR [STDERR]   at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      11:29:41,140 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,156 ERROR [STDERR]   at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      11:29:41,156 ERROR [STDERR]   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:29:41,156 ERROR [STDERR]   at

      Please help......
      Thanks
        • 1. Re: Cannot open connection - urgent help please
          Francisco Jose Peredo Noguez Master

          Hi!
          What application server are you using? Tomcat? JBoss? Which version? over what version of the JDK? What version of Seam are you using?
          Are you using connection pooling? could you please post your connection pooling/datasource configuration here? (without the passwords of course) To which version of what database are you connecting to?
          and please post the full stacktrace (IMO you only posted a part of it).

          • 2. Re: Cannot open connection - urgent help please
            Tasneem Bhyat Newbie
            Hi. Thanks for the quick response. We are using JBoss 4.2.3GA. and JDK 1.6.0_10.Seam is 2.1.0A1. I actually am not sure if we using connection pooling. Where do you I find out if I am. I have a feeling that it is not setup. Reason I am saying this is because in our stress test. What happens, is with 5 users doing things simultaneously, all is fine, except that the CPU usage is extremely high. Then what happens if more than 5 users, the db connections seem to be queueing up, and then the web pages start taking their time to load. not certain as to the cause of this, but I think it is all related. We are using MySQL V1.1.9.
            Your help will be very much appreciated. Thanks
            • 3. Re: Cannot open connection - urgent help please
              Tasneem Bhyat Newbie
              hi Sorry, forgot to post my datasource...this was in the jboss deploy folder


              <?xml version="1.0" encoding="UTF-8"?>
              <datasources>
                
                 <local-tx-datasource>
                    <jndi-name>MST-DS</jndi-name>
                    <connection-url>jdbc:mysql://localhost:3306/mobilesurveytool</connection-url>
                    <driver-class>com.mysql.jdbc.Driver</driver-class>
                    <user-name>root</user-name>
                    <password>root</password>
              <!--
                    <exception-sorter-class-name>
                       org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
                    </exception-sorter-class-name>
                    <metadata>
                       <type-mapping>mySQL</type-mapping>
                    </metadata>
              -->
                 </local-tx-datasource>
                 
              </datasources>

              and the persistence.xml
              <?xml version="1.0" encoding="UTF-8"?>
              <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                  http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
                 
                   <persistence-unit name="MSTUnit" transaction-type="JTA">
                          <jta-data-source>java:/MST-DS</jta-data-source>
                                <properties>
                                 <property name="hibernate.hbm2ddl.auto" value="none"/>
                                 <property name="hibernate.cache.use_query_cache" value="true"/>
                                 <property name="hibernate.show_sql" value="true"/>
                                 <property name="hibernate.connection.release_mode" value="after_statement"/>
                                 <property name="jboss.entity.manager.factory.jndi.name"
                                           value="java:/MobileSurveyToolEnterpriseEntityManagerFactory"/>
                    </properties>
                   </persistence-unit>
               
              </persistence>
              • 4. Re: Cannot open connection - urgent help please
                Stuart Douglas Master

                Try chucking something like:


                
                 <min-pool-size>5</min-pool-size>  
                 <max-pool-size>20</max-pool-size>  
                
                



                In your datasource. I just made those numbers up, so you should pick ones that are right for your app.

                • 5. Re: Cannot open connection - urgent help please
                  Stuart Douglas Master

                  Are you really using mysql 1 or was that a typo?