ryantenney / metrics-spring

Spring integration for Metrics
http://www.ryantenney.com/metrics-spring/
Apache License 2.0
701 stars 226 forks source link

Not working when upgrading to Spring Boot 1.4 #189

Open nickcodefresh opened 8 years ago

nickcodefresh commented 8 years ago

If I upgrade to Spring Boot 1.4 I get the following exception on startup. Thought it might have been linked to #184, but I tried removing @EnableMetrics from my configuration class but it still didn't fix the issue.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exceptionMeteredAnnotationBeanPostProcessor' defined in class path resource [com/ryantenney/metrics/spring/config/annotation/DelegatingMetricsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.beans.factory.config.BeanPostProcessor]: Factory method 'exceptionMeteredAnnotationBeanPostProcessor' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getMetricRegistry' defined in class path resource [com/ryantenney/metrics/spring/config/annotation/DelegatingMetricsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.codahale.metrics.MetricRegistry]: Factory method 'getMetricRegistry' threw exception; nested exception is java.lang.IllegalStateException: Failed to introspect annotations on public com.codahale.metrics.MetricRegistry com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry()
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:240)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:697)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:526)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
    at tv.nativ.mio.events.Application.main(Application.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.beans.factory.config.BeanPostProcessor]: Factory method 'exceptionMeteredAnnotationBeanPostProcessor' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getMetricRegistry' defined in class path resource [com/ryantenney/metrics/spring/config/annotation/DelegatingMetricsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.codahale.metrics.MetricRegistry]: Factory method 'getMetricRegistry' threw exception; nested exception is java.lang.IllegalStateException: Failed to introspect annotations on public com.codahale.metrics.MetricRegistry com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry()
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 23 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getMetricRegistry' defined in class path resource [com/ryantenney/metrics/spring/config/annotation/DelegatingMetricsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.codahale.metrics.MetricRegistry]: Factory method 'getMetricRegistry' threw exception; nested exception is java.lang.IllegalStateException: Failed to introspect annotations on public com.codahale.metrics.MetricRegistry com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry()
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:381)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.getMetricRegistry(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurationSupport.exceptionMeteredAnnotationBeanPostProcessor(MetricsConfigurationSupport.java:64)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.CGLIB$exceptionMeteredAnnotationBeanPostProcessor$5(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57$$FastClassBySpringCGLIB$$f5aaeb49.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.exceptionMeteredAnnotationBeanPostProcessor(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 24 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.codahale.metrics.MetricRegistry]: Factory method 'getMetricRegistry' threw exception; nested exception is java.lang.IllegalStateException: Failed to introspect annotations on public com.codahale.metrics.MetricRegistry com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry()
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 45 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to introspect annotations on public com.codahale.metrics.MetricRegistry com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry()
    at org.springframework.core.annotation.AnnotatedElementUtils.searchWithFindSemantics(AnnotatedElementUtils.java:1091)
    at org.springframework.core.annotation.AnnotatedElementUtils.searchWithFindSemantics(AnnotatedElementUtils.java:1060)
    at org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotationAttributes(AnnotatedElementUtils.java:656)
    at org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation(AnnotatedElementUtils.java:730)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:314)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.getMetricRegistry(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerComposite.getMetricRegistry(MetricsConfigurerComposite.java:52)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry(DelegatingMetricsConfiguration.java:59)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.CGLIB$getMetricRegistry$2(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57$$FastClassBySpringCGLIB$$f5aaeb49.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.getMetricRegistry(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerComposite.getMetricRegistry(MetricsConfigurerComposite.java:52)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry(DelegatingMetricsConfiguration.java:59)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.CGLIB$getMetricRegistry$2(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57$$FastClassBySpringCGLIB$$f5aaeb49.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.getMetricRegistry(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerComposite.getMetricRegistry(MetricsConfigurerComposite.java:52)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry(DelegatingMetricsConfiguration.java:59)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.CGLIB$getMetricRegistry$2(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57$$FastClassBySpringCGLIB$$f5aaeb49.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.getMetricRegistry(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerComposite.getMetricRegistry(MetricsConfigurerComposite.java:52)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry(DelegatingMetricsConfiguration.java:59)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.CGLIB$getMetricRegistry$2(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57$$FastClassBySpringCGLIB$$f5aaeb49.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.getMetricRegistry(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerComposite.getMetricRegistry(MetricsConfigurerComposite.java:52)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration.getMetricRegistry(DelegatingMetricsConfiguration.java:59)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57.CGLIB$getMetricRegistry$2(<generated>)
    at com.ryantenney.metrics.spring.config.annotation.DelegatingMetricsConfiguration$$EnhancerBySpringCGLIB$$ebc91b57$$FastClassBySpringCGLIB$$f5aaeb49.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
haninaguib commented 8 years ago

I have also ran into this issue. Will try to figure a solution.

Nocturnhabeo commented 8 years ago

Any progress on this or a work around I am running into the same issue.

Nocturnhabeo commented 8 years ago

Updating to Spring boot 1.4.1 fixed the problem.