java.lang.IllegalStateException: Duplicate mock definition [MockDefinition@1b68b9a4 name = '', classToMock = IdentityProvider, extraInterfaces = set[[empty]], answer = RETURNS_DEFAULTS, serializable = false, reset = AFTER]

GitHub | rocketraman | 4 months ago
  1. 0

    @MockBean does not handle parameterized types

    GitHub | 4 months ago | rocketraman
    java.lang.IllegalStateException: Duplicate mock definition [MockDefinition@1b68b9a4 name = '', classToMock = IdentityProvider, extraInterfaces = set[[empty]], answer = RETURNS_DEFAULTS, serializable = false, reset = AFTER]
  2. 0

    Simple WebMvcTest fails with Spring Boot 1.4M3 due to missing SpringBootConfiguration

    GitHub | 7 months ago | jgoldhammer
    java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
  3. 0

    How to use Spring Hatoas ControllerLinkBuilder for a Thymeleaf templated scheduled email

    Stack Overflow | 1 year ago | Romell
    java.lang.IllegalStateException: Could not find current request via RequestContextHolder. Is this being called from a Spring MVC handler?
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    jetty 9.3.1 and 9.3.2 can't find resource in /src/main/webapp

    GitHub | 1 year ago | zhanhb
    java.lang.IllegalStateException: Cannot find template location: /WEB-INF/templates (please add some templates or check your Thymeleaf configuration)
  6. 0

    Unable to configure LocalContainerEntityManagerFactoryBean from @EntityScan, ensure an appropriate bean is registered.

    GitHub | 1 year ago | f0def
    org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/csus]]
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    Duplicate mock definition [MockDefinition@1b68b9a4 name = '', classToMock = IdentityProvider, extraInterfaces = set[[empty]], answer = RETURNS_DEFAULTS, serializable = false, reset = AFTER]

    at org.springframework.util.Assert.state()
  2. Spring Core
    Assert.state
    1. org.springframework.util.Assert.state(Assert.java:392)
    1 frame
  3. org.springframework.boot
    DefinitionsParser$1.doWith
    1. org.springframework.boot.test.mock.mockito.DefinitionsParser.addDefinition(DefinitionsParser.java:119)
    2. org.springframework.boot.test.mock.mockito.DefinitionsParser.parseMockBeanAnnotation(DefinitionsParser.java:97)
    3. org.springframework.boot.test.mock.mockito.DefinitionsParser.parseElement(DefinitionsParser.java:76)
    4. org.springframework.boot.test.mock.mockito.DefinitionsParser.access$000(DefinitionsParser.java:42)
    5. org.springframework.boot.test.mock.mockito.DefinitionsParser$1.doWith(DefinitionsParser.java:67)
    5 frames
  4. Spring Core
    ReflectionUtils.doWithFields
    1. org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:692)
    2. org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:672)
    2 frames
  5. org.springframework.boot
    MockitoContextCustomizerFactory.createContextCustomizer
    1. org.springframework.boot.test.mock.mockito.DefinitionsParser.parse(DefinitionsParser.java:62)
    2. org.springframework.boot.test.mock.mockito.MockitoContextCustomizerFactory.createContextCustomizer(MockitoContextCustomizerFactory.java:38)
    2 frames
  6. Spring TestContext
    AbstractTestContextBootstrapper.buildTestContext
    1. org.springframework.test.context.support.AbstractTestContextBootstrapper.getContextCustomizers(AbstractTestContextBootstrapper.java:418)
    2. org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:387)
    3. org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:323)
    4. org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:277)
    5. org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:112)
    5 frames
  7. org.springframework.boot
    SpringBootTestContextBootstrapper.buildTestContext
    1. org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:74)
    1 frame
  8. Spring TestContext
    SpringRunner.<init>
    1. org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:120)
    2. org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:105)
    3. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:152)
    4. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:143)
    5. org.springframework.test.context.junit4.SpringRunner.<init>(SpringRunner.java:49)
    5 frames
  9. Java RT
    Constructor.newInstance
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    4 frames
  10. JUnit
    ClassRequest.getRunner
    1. org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    2. org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    3. org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    4. org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    5. org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    6. org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
    6 frames
  11. IntelliJ junit4 module
    JUnit4IdeaTestRunner.startRunnerWithArgs
    1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:96)
    2. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
    2 frames
  12. IDEA
    JUnitStarter.main
    1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:253)
    2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
    2 frames
  13. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:498)
    4 frames
  14. IDEA
    AppMain.main
    1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
    1 frame