org.springframework.beans.factory.BeanCreationException: Could not inject field: protected static com.services.SchedulerService com.test.SchedulerControllerTest.schedulerServiceTest; nested exception is java.lang.IllegalStateException: The field protected static com.services.SchedulerService com.test.SchedulerControllerTest.schedulerServiceTest cannot have an existing value

Stack Overflow | Jayesh Mule | 2 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    cannot have an existing value spring boot mockito testing error

    Stack Overflow | 2 months ago | Jayesh Mule
    org.springframework.beans.factory.BeanCreationException: Could not inject field: protected static com.services.SchedulerService com.test.SchedulerControllerTest.schedulerServiceTest; nested exception is java.lang.IllegalStateException: The field protected static com.services.SchedulerService com.test.SchedulerControllerTest.schedulerServiceTest cannot have an existing value
  2. 0

    Spring boot test with Mockito

    GitHub | 3 months ago | venkatgavulla
    java.lang.NoSuchMethodError: org.springframework.beans.factory.support.RootBeanDefinition.setTargetType(Lorg/springframework/core/ResolvableType;)V
  3. 0

    GitHub comment 7033#252793702

    GitHub | 6 months ago | philwebb
    java.lang.IllegalStateException: Failed to load ApplicationContext
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

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

    The field protected static com.services.SchedulerService com.test.SchedulerControllerTest.schedulerServiceTest cannot have an existing value

    at org.springframework.util.Assert.state()
  2. Spring Core
    Assert.state
    1. org.springframework.util.Assert.state(Assert.java:392)[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    1 frame
  3. org.springframework.boot
    MockitoTestExecutionListener.prepareTestInstance
    1. org.springframework.boot.test.mock.mockito.MockitoPostProcessor.inject(MockitoPostProcessor.java:400)[spring-boot-test-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    2. org.springframework.boot.test.mock.mockito.MockitoPostProcessor.inject(MockitoPostProcessor.java:393)[spring-boot-test-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    3. org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.injectFields(MockitoTestExecutionListener.java:73)[spring-boot-test-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    4. org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.injectFields(MockitoTestExecutionListener.java:62)[spring-boot-test-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    5. org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.prepareTestInstance(MockitoTestExecutionListener.java:49)[spring-boot-test-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    5 frames
  4. Spring TestContext
    SpringJUnit4ClassRunner$1.runReflectiveCall
    1. org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    3. org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    3 frames
  5. JUnit
    ReflectiveCallable.run
    1. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)[junit-4.12.jar:4.12]
    1 frame
  6. Spring TestContext
    SpringJUnit4ClassRunner.runChild
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    3. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    3 frames
  7. JUnit
    ParentRunner$2.evaluate
    1. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)[junit-4.12.jar:4.12]
    2. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)[junit-4.12.jar:4.12]
    3. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)[junit-4.12.jar:4.12]
    4. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)[junit-4.12.jar:4.12]
    5. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)[junit-4.12.jar:4.12]
    5 frames
  8. Spring TestContext
    RunAfterTestClassCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    2 frames
  9. JUnit
    ParentRunner.run
    1. org.junit.runners.ParentRunner.run(ParentRunner.java:363)[junit-4.12.jar:4.12]
    1 frame
  10. Spring TestContext
    SpringJUnit4ClassRunner.run
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)[spring-test-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    1 frame
  11. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)[.cp/:na]
    1 frame
  12. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)[.cp/:na]
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)[.cp/:na]
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)[.cp/:na]
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)[.cp/:na]
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)[.cp/:na]
    5 frames