Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError: org/LatencyUtils/IntervalEstimator in Springboot 2.3.0 #21538

Closed
yuanpli opened this issue May 22, 2020 · 19 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@yuanpli
Copy link

yuanpli commented May 22, 2020

Springboot 2.3.0 application start failed when enabling actuator by add dependency of spring-boot-starter-actuator.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourc
ePoolMetricsAutoConfiguration$HikariDataSourceMetricsConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.NoClassDefFoun
dError: org/LatencyUtils/IntervalEstimator
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:
405) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-b
eans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-be
ans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-bean
s-5.2.6.RELEASE.jar:5.2.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.
2.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RE
LEASE.jar:5.2.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEA
SE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE
]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895) ~[spring-beans-
5.2.6.RELEASE.jar:5.2.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-conte
xt-5.2.6.RELEASE.jar:5.2.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
        at com.test.MainApp.main(MainApp.java:19) [starter-0.0.1.jar:?]
Caused by: java.lang.NoClassDefFoundError: org/LatencyUtils/IntervalEstimator
        at io.micrometer.core.instrument.simple.SimpleMeterRegistry.newTimer(SimpleMeterRegistry.java:90) ~[micrometer-core-1.5.1.jar:1.5.1]
        at io.micrometer.core.instrument.MeterRegistry.lambda$timer$2(MeterRegistry.java:308) ~[micrometer-core-1.5.1.jar:1.5.1]
        at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:612) ~[micrometer-core-1.5.1.jar:1.5.1]
        at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:566) ~[micrometer-core-1.5.1.jar:1.5.1]
        at io.micrometer.core.instrument.MeterRegistry.timer(MeterRegistry.java:306) ~[micrometer-core-1.5.1.jar:1.5.1]
        at io.micrometer.core.instrument.Timer$Builder.register(Timer.java:539) ~[micrometer-core-1.5.1.jar:1.5.1]
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 22, 2020
@bclozel
Copy link
Member

bclozel commented May 22, 2020

Could you provide a sample application reproducing this problem?
This dependency is brought by micrometer-core and should be there; I don't believe we're doing anything special for that besides applying the micrometer BOM.

Thanks!

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label May 22, 2020
@izeye
Copy link
Contributor

izeye commented May 22, 2020

@yuanpli org.latencyutils:LatencyUtils jar file seems to be corrupted somehow. Deleting it from build cache and rebuilding the project will work if that's the case.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 22, 2020
@izeye
Copy link
Contributor

izeye commented May 22, 2020

Oops, @spring-buildmaster handled my comment as the expected feedback.

@yuanpli
Copy link
Author

yuanpli commented May 25, 2020

Could you provide a sample application reproducing this problem?
This dependency is brought by micrometer-core and should be there; I don't believe we're doing anything special for that besides applying the micrometer BOM.

Thanks!

@bclozel Hello, org.latencyutils.LatencyUtils is a runtime dependency at micrometer-core. This scope indicates that the dependency is not required for compilation, but is for execution. So it has to be included in spring at least.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 25, 2020
@yuanpli
Copy link
Author

yuanpli commented May 25, 2020

@yuanpli org.latencyutils:LatencyUtils jar file seems to be corrupted somehow. Deleting it from build cache and rebuilding the project will work if that's the case.

Hi, it doesn't work. :(

@izeye
Copy link
Contributor

izeye commented May 25, 2020

@yuanpli Thanks for the feedback.

If that's not the case, I'm not sure how it could happen. As @bclozel asked you before, a sample project seems to be necessary to know what happens there.

For your information, this is what I used to check this issue before: https://github.com/izeye/sample-micrometer-spring-boot

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 25, 2020
@philwebb
Copy link
Member

Possibly related to #21507. @yuanpli Are you running your tests in IntelliJ?

@yuanpli
Copy link
Author

yuanpli commented May 29, 2020

Possibly related to #21507. @yuanpli Are you running your tests in IntelliJ?

No, I am running in build jar

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 29, 2020
@bclozel
Copy link
Member

bclozel commented May 29, 2020

At this point we’ll need a sample project that reproduces the problem if we want to make progress. Can you provide that @yuanpli ?

@bclozel bclozel added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 29, 2020
@yuanpli
Copy link
Author

yuanpli commented Jun 1, 2020

Hi all,

Sorry, this is not an issue. We just only copy compile dependencies in my project.
Thanks for all of your support!

Br,
Yuanping

@yuanpli yuanpli closed this as completed Jun 1, 2020
@snicoll snicoll added status: invalid An issue that we don't feel is valid and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Jun 1, 2020
@mparlee
Copy link

mparlee commented Jun 3, 2020

I think this should be re-opened. I didn't understand what yanpli's resolution was.

I encountered this issue upgrading an existing project to 2.3.0 and was only able to resolve it by reverting to 2.2.6.

Including the missing dependency did not resolve the issue.

@spencergibb
Copy link
Member

@mparlee

At this point we’ll need a sample project that reproduces the problem if we want to make progress. Can you provide that?

@shaswata09
Copy link

shaswata09 commented Aug 22, 2020

Hi, the same issue occured for me as well but couldnt find any solutions... I'm also very new to spring and still in learning phase... Any help is appriciated...

Replication code base can be found at:
https://github.com/shaswata09/spring-boot-practice-projects/tree/master

After I added dependency of actuator, the following error occured...

   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
  </dependency>

Other Infos:
IDE = Intellij IDEA
OS: Ubuntu 20.04.1

@spring-issuemaster

@snicoll
Copy link
Member

snicoll commented Aug 22, 2020

Replication code base can be found at:
https://github.com/shaswata09/spring-boot-practice-projects/tree/master

Ignoring that weird my-alternate-repository repository that I've removed locally, the application starts correctly for me.

@shaswata09
Copy link

Replication code base can be found at:
https://github.com/shaswata09/spring-boot-practice-projects/tree/master

Ignoring that weird my-alternate-repository repository that I've removed locally, the application starts correctly for me.

Have you added the actuator dependency? In my case after adding the dependency it threw above mentioned runtime error.

@snicoll
Copy link
Member

snicoll commented Aug 23, 2020

Have you added the actuator dependency?

Yes. Please run the project from the command line (mvn spring-boot:run) as I suspect your IDE configuration is broken. This issue tracker is not the right place to get support on that though.

@nsarvar
Copy link

nsarvar commented Jul 26, 2022

@yuanpli org.latencyutils:LatencyUtils jar file seems to be corrupted somehow. Deleting it from build cache and rebuilding the project will work if that's the case.

that worked for me

@Sucran
Copy link

Sucran commented Apr 28, 2023

Oh god! I found it really hard to understand this solution of @yuanpli about
image

I think this solution need to be describe as :

To change the maven or gradle script like this below:

compile("io.micrometer:micrometer-core:1.10.3")

to

compile("io.micrometer:micrometer-core:1.10.3") {
exclude group: "org.latencyutils"
}
compile("org.latencyutils:LatencyUtils:2.0.3")

@omarelhussein
Copy link

Deleting the build folder did not work in my case, I was able to fix this issue by updating IntelliJ to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests