j'essaie de mettre en place mon application de démarrage de printemps, mais je suis confronté à un problème et les détails de l'exception sont les suivants

{"Date":"2019-11-03T20:07:38,905","Thread":"localhost-startStop-1","Identifiers":{"Jvm-Instance":"1@af2e2eedeab7","App-Name":"application","Version":"1.0.0-n/a-n/a-n/a","Thread-Group":"main","Thread-Id":"37"},"Level":"ERROR","Logger":"org.springframework.boot.SpringApplication","Msg":"Application run failed","Exception-Message":"Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsRegistrarConfiguration': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: net.sf.ehcache.Ehcache.getStatistics()Lnet/sf/ehcache/statistics/StatisticsGateway;","Stack-Trace":["at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:138)","at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:422)","at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698)","at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579)","at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)","at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)","at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)","at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)","at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)","at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)","at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)","at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)","at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)","at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)","at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)","at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)","at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:155)","at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:135)","at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:87)","at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)","at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)","at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)","at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)","at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)","at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)","at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)","at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)","at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)","at java.util.concurrent.FutureTask.run(FutureTask.java:266)","at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)","at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java)","at java.lang.Thread.run(Thread.java:748)"]}
    dap-controller_1  | Nov 03, 2019 8:07:38 PM org.apache.catalina.core.ContainerBase addChildInternal
    dap-controller_1  | SEVERE: ContainerBase.addChild: start:
    dap-controller_1  | org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/dap-controller]]
    dap-controller_1  |     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    dap-controller_1  |     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
    dap-controller_1  |     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    dap-controller_1  |     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    dap-controller_1  |     at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
    dap-controller_1  |     at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
    dap-controller_1  |     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    dap-controller_1  |     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    dap-controller_1  |     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    dap-controller_1  |     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java)
    dap-controller_1  |     at java.lang.Thread.run(Thread.java:748)
    dap-controller_1  | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsRegistrarConfiguration': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: net.sf.ehcache.Ehcache.getStatistics()Lnet/sf/ehcache/statistics/StatisticsGateway;
    dap-controller_1  |     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:138)
    dap-controller_1  |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:422)
    dap-controller_1  |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698)
    dap-controller_1  |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579)
    dap-controller_1  |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
    dap-controller_1  |     at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    dap-controller_1  |     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    dap-controller_1  |     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    dap-controller_1  |     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    dap-controller_1  |     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
    dap-controller_1  |     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
    dap-controller_1  |     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
    dap-controller_1  |     at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
    dap-controller_1  |     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    dap-controller_1  |     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
    dap-controller_1  |     at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
    dap-controller_1  |     at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:155)
    dap-controller_1  |     at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:135)
    dap-controller_1  |     at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:87)
    dap-controller_1  |     at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
    dap-controller_1  |     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)
    dap-controller_1  |     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    dap-controller_1  |     ... 10 more
    dap-controller_1  | Caused by: java.lang.NoSuchMethodError: net.sf.ehcache.Ehcache.getStatistics()Lnet/sf/ehcache/statistics/StatisticsGateway;
    dap-controller_1  |     at io.micrometer.core.instrument.binder.cache.EhCache2Metrics.<init>(EhCache2Metrics.java:36)
    dap-controller_1  |     at org.springframework.boot.actuate.metrics.cache.EhCache2CacheMeterBinderProvider.getMeterBinder(EhCache2CacheMeterBinderProvider.java:36)
    dap-controller_1  |     at org.springframework.boot.actuate.metrics.cache.EhCache2CacheMeterBinderProvider.getMeterBinder(EhCache2CacheMeterBinderProvider.java:31)
    dap-controller_1  |     at org.springframework.boot.actuate.metrics.cache.CacheMetricsRegistrar.lambda$getMeterBinder$0(CacheMetricsRegistrar.java:76)
    dap-controller_1  |     at org.springframework.boot.util.LambdaSafe$Callbacks.lambda$null$2(LambdaSafe.java:306)
    dap-controller_1  |     at org.springframework.boot.util.LambdaSafe$LambdaSafeCallback.invoke(LambdaSafe.java:162)
    dap-controller_1  |     at org.springframework.boot.util.LambdaSafe$Callbacks.lambda$invokeAnd$3(LambdaSafe.java:305)
    dap-controller_1  |     at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    dap-controller_1  |     at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
    dap-controller_1  |     at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
    dap-controller_1  |     at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
    dap-controller_1  |     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
    dap-controller_1  |     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    dap-controller_1  |     at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
    dap-controller_1  |     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    dap-controller_1  |     at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
    dap-controller_1  |     at org.springframework.boot.actuate.metrics.cache.CacheMetricsRegistrar.getMeterBinder(CacheMetricsRegistrar.java:78)
    dap-controller_1  |     at org.springframework.boot.actuate.metrics.cache.CacheMetricsRegistrar.bindCacheToRegistry(CacheMetricsRegistrar.java:62)
    dap-controller_1  |     at org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsRegistrarConfiguration.bindCacheToRegistry(CacheMetricsRegistrarConfiguration.java:79)
    dap-controller_1  |     at org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsRegistrarConfiguration.lambda$bindCacheManagerToRegistry$0(CacheMetricsRegistrarConfiguration.java:73)
    dap-controller_1  |     at java.lang.Iterable.forEach(Iterable.java:75)
    dap-controller_1  |     at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080)
    dap-controller_1  |     at org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsRegistrarConfiguration.bindCacheManagerToRegistry(CacheMetricsRegistrarConfiguration.java:73)
    dap-controller_1  |     at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
    dap-controller_1  |     at org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsRegistrarConfiguration.bindCachesToRegistry(CacheMetricsRegistrarConfiguration.java:69)
    dap-controller_1  |     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    dap-controller_1  |     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    dap-controller_1  |     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    dap-controller_1  |     at java.lang.reflect.Method.invoke(Method.java:498)
    dap-controller_1  |     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:365)
    dap-controller_1  |     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:308)
    dap-controller_1  |     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:135)
    dap-controller_1  |     ... 31 more

J'utilise actuellement Spring Boot version 2.0.2.RELEASE et j'utilise également

<dependency>
                <groupId>net.sf.ehcache</groupId>
                <artifactId>ehcache</artifactId>
                <version>2.10.4</version>
          </dependency>

mais je reçois toujours la même erreur, toute aide est grandement appréciée

Merci d'avance

0
Shashikanth Ramarao 4 nov. 2019 à 07:22

2 réponses

j'ai pu résoudre ce problème moi-même, le problème était comme si j'utilisais la version 2.10.4 pour ehcache j'avais une autre dépendance qui utilisait l'ancienne version d'ehcache qui était considérée, donc j'obtenais cette erreur et une fois que j'ai exclu que version particulière alors j'ai pu obtenir mon ap et opérationnel. je remercie M. Deinum et Ananthapadmanabhan d'avoir répondu à ma question

0
Shashikanth Ramarao 5 nov. 2019 à 17:36

Actuellement, le micromètre de démarrage de printemps nécessite une version ehcache minimale de 2.10.4 pour que la méthode net.sf.ehcache.Ehcache.getStatistics() fonctionne. Donc, vérifiez que la version ehcache est correctement résolue par maven ou sinon mettez à niveau la version ehcache vers une nouvelle version et réessayez.

0
Ananthapadmanabhan 4 nov. 2019 à 04:55