I am trying to test a web-based application. The webserver I am using is wildfly and API for database access is JDBC.
The problem is that I am trying to automate tests using selenium webdriver. At first I run the server and using a separate Eclipse project I run my selenium tests.
In the tests a browser is opened a link is accessed and then login is done and then some searches of the database through the software... etc. It is obvious that during the span of the tests the DB is called upon several times.
In the first few runs of the tests everything works just fine but then suddenly I start getting the errors:
16:01:31,580 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-36) SQL Error: 0, SQLState: null
16:01:31,581 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-36) javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/OracleDS
16:01:31,585 ERROR [org.jboss.as.ejb3] (default task-36) javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Could not open connection
16:01:31,586 ERROR [org.jboss.as.ejb3.invocation] (default task-36) JBAS014134: EJB Invocation failed on component FidaRoleConfigurationDao for method public java.util.List ag.rul.safex.fida.authentication.dataaccess.FidaRoleConfigurationDao.findAllByExternalRoles(java.util.Set): javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:163) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:253) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:342) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
I assume it has something to do with connections that my program creates with the DB. It can be the connections are created too fast that somehow breaks the system or maybe too many connections are made and due to connection leakage somewhere this problem happens.
PS: I talked to another developer and he said that sometimes he also gets the same issues even when he is working on the software normally (i.e. not doing automated fast testing). Then he just re-launches the server to fix the problem.
Please let me know what other information is required. Pom.xml or Persistence or something else. It is a very persistent problem that I would really appreciate help with.
Thanks in advance.