Clover instrumented code fails to connect application database

I have a web application deployed as war in tomcat in instrumented jars in it. Strangely I observe that the instrumented code throwing exception that connection to db fails.

I followed the link https://answers.atlassian.com/questions/129283

Is this because there is degreadation in performance of the instrumented code? Anybody else has seen this behavior especially with hsqldb?

2 answers

0 votes

Could you paste a stack trace?

Here is the stacktrace:

WARN: HHH000342: Could not obtain connection to query metadata : java.net.ConnectException: Connection refused: connect
Nov 28, 2014 09:23:03 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute():201 
ERROR: HHH000319: Could not get database metadata
java.sql.SQLTransientConnectionException: java.net.ConnectException: Connection refused: connect
    at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:119) ~[c3p0-0.9.1.2.jar:0.9.1.2]
  
  at 
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:143)
 ~[c3p0-0.9.1.2.jar:0.9.1.2]
    at 
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:132)
 ~[c3p0-0.9.1.2.jar:0.9.1.2]
    at 
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.initializeAutomaticTestTable(C3P0PooledConnectionPoolManager.java:772)
 ~[c3p0-0.9.1.2.jar:0.9.1.2]
    at 
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:696)
 ~[c3p0-0.9.1.2.jar:0.9.1.2]
    at 
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:257)
 ~[c3p0-0.9.1.2.jar:0.9.1.2]
    at 
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:271)
 ~[c3p0-0.9.1.2.jar:0.9.1.2]
    at 
com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
 ~[c3p0-0.9.1.2.jar:0.9.1.2]
    at 
org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)
 ~[hibernate-entitymanager-4.1.2.jar:4.1.2]
    at 
org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
 ~[hibernate-core-4.1.2.jar:4.1.2]
    at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) ~[hibernate-core-4.1.2.jar:4.1.2]
    at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) ~[hibernate-core-4.1.2.jar:4.1.2]
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:495) ~[hibernate-core-4.1.2.jar:4.1.2]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1741) ~[hibernate-core-4.1.2.jar:4.1.2]
  
  at 
org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:93)
 ~[hibernate-entitymanager-4.1.2.jar:4.1.2]
    at 
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
 [hibernate-entitymanager-4.1.2.jar:4.1.2]
    at 
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
 [hibernate-entitymanager-4.1.2.jar:4.1.2]
    at 
org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
 [hibernate-entitymanager-4.1.2.jar:4.1.2]
    at 
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
 [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
 [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:529)
 [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:495)
 [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:656)
 [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:629)
 [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:338)
 [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
 [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
 [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
 [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
 [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
 [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at 
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
 [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887) [catalina.jar:7.0.41]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381) [catalina.jar:7.0.41]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.41]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.41]
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.41]
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) [catalina.jar:7.0.41]
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976) [catalina.jar:7.0.41]
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653) [catalina.jar:7.0.41]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.7.0_45]
    at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_45]
    at java.lang.Thread.run(Unknown Source) [na:1.7.0_45]
Caused by: org.hsqldb.HsqlException: java.net.ConnectException: Connection refused: connect
    at org.hsqldb.ClientConnection.openConnection(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    at org.hsqldb.ClientConnection.initConnection(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    at org.hsqldb.ClientConnection.<init>(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    ... 90 common frames omitted
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[na:1.7.0_45]
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[na:1.7.0_45]
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:1.7.0_45]
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.7.0_45]
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.7.0_45]
    at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.7.0_45]
    at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.7.0_45]
    at java.net.Socket.connect(Unknown Source) ~[na:1.7.0_45]
    at java.net.Socket.connect(Unknown Source) ~[na:1.7.0_45]
    at java.net.Socket.<init>(Unknown Source) ~[na:1.7.0_45]
    at java.net.Socket.<init>(Unknown Source) ~[na:1.7.0_45]
    at org.hsqldb.server.HsqlSocketFactory.createSocket(Unknown Source) ~[hsqldb-2.3.0.jar:2.3.0]
    ... 93 common frames omitted

I see nothing related with Clover in this stack trace. Are you trying to connect to HSQLDB running on a localhost? Is HSQLB running at the moment when this error occurs? For me, it looks like socket connection just failed because no service was running on specified port...

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Monday in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

305 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you