question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoClassDefFoundError: org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider

See original GitHub issue

when i add

 <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-prometheus</artifactId>
      <version>1.2.1</version>
    </dependency>

    <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-spring-legacy</artifactId>
      <version>1.2.1</version>
    </dependency>

to the pom.xml to use prometheus an error occured :

 INFO 13530 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@209da20d: startup date [Thu Feb 27 14:59:04 CST 2020]; root of context hierarchy
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.getDeclaredMethods(Class.java:1975)
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
	at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:425)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:515)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:508)
	at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1188)
	at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:818)
	at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:804)
	at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:790)
	at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:744)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
	at com.maodou.AgentBalanceApplication.main(AgentBalanceApplication.java:24)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.metrics.cache.CacheMeterBinderProvider
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 36 more

can u tell me what happended , the same configuration in system can work.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
a2422894769commented, Oct 23, 2020

it might cause by Redisson , try @EnableAutoConfiguration(exclude = {RedissonCacheStatisticsAutoConfiguration.class})

thank you , it`s Successfully solved my problem

1reaction
anotherMe17commented, Sep 22, 2020

it might cause by Redisson , try @EnableAutoConfiguration(exclude = {RedissonCacheStatisticsAutoConfiguration.class})

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I solve "java.lang.NoClassDefFoundError"?
The NoClassDefFoundError indicates that the classloader (in this case java.net.URLClassLoader ), which is responsible for dynamically loading classes, cannot ...
Read more >
3 ways to solve java.lang.NoClassDefFoundError in Java J2EE
A simple example of NoClassDefFoundError is class belongs to a missing JAR file or JAR was not added into classpath or sometimes jar's...
Read more >
java.lang.NoClassDefFoundError - DigitalOcean
NoClassDefFoundError is runtime error thrown when a required class is not found in the classpath and hence JVM is unable to load it...
Read more >
Error "java.lang.NoClassDefFoundError - My Oracle Support
Error "java.lang.NoClassDefFoundError: com/oracle/cie/encryption/AbstractEncryptionService" Starting a Collocated Agent after Updating ...
Read more >
Why am I encountering java.lang.NoClassDefFoundError at ...
In workbench, adding projects directly to the java build path will allow code to compile, but it will not be able to resolve...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found