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

Joda-Time presence check fails to detect Joda-Time 2.x specifically #25655

Closed
jproples opened this issue Aug 28, 2020 · 1 comment
Closed

Joda-Time presence check fails to detect Joda-Time 2.x specifically #25655

jproples opened this issue Aug 28, 2020 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@jproples
Copy link

We upgrade our project from 2.2.1 to 2.3.3 and now we are getting this exception. We found that you are no longer managing joda-time (in past it was 2.10.5) but query-dsl( managed 4.3.1) brings 1.6.

The DefaultFormattingConversionService detectes joda time on the classpath and calls the JodaTimeFormatterRegistrar#registerFormatters which contains the following lines. Which both references not existing classes in joda 1.6 (YearMonth and MonthDay) both were added in joda 2.0 according to the javadoc.

registry.addFormatterForFieldType(YearMonth.class, new YearMonthFormatter());
registry.addFormatterForFieldType(MonthDay.class, new MonthDayFormatter());
java.lang.NoClassDefFoundError: org/joda/time/YearMonth

	at org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar.registerFormatters(JodaTimeFormatterRegistrar.java:203)
	at org.springframework.format.support.DefaultFormattingConversionService.addDefaultFormatters(DefaultFormattingConversionService.java:127)
	at org.springframework.boot.convert.ApplicationConversionService.configure(ApplicationConversionService.java:98)
	at org.springframework.boot.convert.ApplicationConversionService.<init>(ApplicationConversionService.java:61)
	at org.springframework.boot.convert.ApplicationConversionService.<init>(ApplicationConversionService.java:54)
	at org.springframework.boot.convert.ApplicationConversionService.getSharedInstance(ApplicationConversionService.java:80)
	at org.springframework.boot.context.properties.bind.Binder.<init>(Binder.java:165)
	at org.springframework.boot.context.properties.bind.Binder.<init>(Binder.java:140)
	at org.springframework.boot.context.properties.bind.Binder.<init>(Binder.java:121)
	at org.springframework.boot.context.properties.bind.Binder.<init>(Binder.java:76)
	at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.getWebApplicationType(SpringBootTestContextBootstrapper.java:172)
	at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.processMergedContextConfiguration(SpringBootTestContextBootstrapper.java:156)
	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:395)
	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:312)
	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:265)
	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:108)
	at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:101)
	at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:137)
	at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:122)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:151)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:142)
	at org.springframework.test.context.junit4.SpringRunner.<init>(SpringRunner.java:49)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
	at org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveAnnotatedBuilder.buildRunner(DefensiveAllDefaultPossibilitiesBuilder.java:114)
	at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
	at org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder.runnerForClass(DefensiveAllDefaultPossibilitiesBuilder.java:57)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
	at org.junit.vintage.engine.discovery.ClassSelectorResolver.resolveTestClass(ClassSelectorResolver.java:66)
	at org.junit.vintage.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:47)
	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:134)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1631)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:185)
	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:125)
	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:91)
	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:82)
	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
	at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:44)
	at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:63)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:181)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:168)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)


@wilkinsona
Copy link
Member

wilkinsona commented Aug 28, 2020

Thanks for the report. I think this should be addressed in Spring Framework. JodaTimeFormatterRegistrar notes that "Joda-Time support requires Joda-Time 2.x" but DefaultFormattingConversionService checks for Joda-Time's presence using org.joda.time.LocalDateTime which was added in Joda-Time 1.3. We'll transfer the issue to spring-projects/spring-framework.

@bclozel bclozel transferred this issue from spring-projects/spring-boot Aug 28, 2020
@bclozel bclozel added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 28, 2020
@jhoeller jhoeller changed the title NoClassDefFoundError: org/joda/time/YearMonth with 2.3.3 Joda-Time presence check fails to detect Joda-Time 2.x specifically Aug 28, 2020
@jhoeller jhoeller self-assigned this Aug 28, 2020
@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 28, 2020
@jhoeller jhoeller added this to the 5.2.9 milestone Aug 28, 2020
@jhoeller jhoeller added the for: backport-to-5.1.x Marks an issue as a candidate for backport to 5.1.x label Aug 28, 2020
@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.1.x Marks an issue as a candidate for backport to 5.1.x labels Aug 28, 2020
jhoeller added a commit that referenced this issue Aug 28, 2020
jhoeller added a commit that referenced this issue Aug 28, 2020
engimatic pushed a commit to engimatic/spring-framework that referenced this issue Sep 29, 2020
zx20110729 pushed a commit to zx20110729/spring-framework that referenced this issue Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants