java.lang.IllegalStateException: Failed to load ApplicationContext

developpez.net | 5 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    [JUnit / Spring] Erreur "failed to load applicationContext.xml(spring)"

    developpez.net | 5 months ago
    java.lang.IllegalStateException: Failed to load ApplicationContext

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

      at be.bibliotheque.repository.BaseRepository.<init>()
    2. be.bibliotheque.repository
      ExemplaireRepository$$EnhancerByCGLIB$$b1c6e365.<init>
      1. be.bibliotheque.repository.BaseRepository.<init>(BaseRepository.java:21)
      2. be.bibliotheque.repository.ExemplaireRepository.<init>(ExemplaireRepository.java:7)
      3. be.bibliotheque.repository.ExemplaireRepository$$EnhancerByCGLIB$$b1c6e365.<init>(<generated>)
      3 frames
    3. Java RT
      Constructor.newInstance
      1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      4. java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      4 frames
    4. Code Generation Library
      ReflectUtils.newInstance
      1. net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:228)
      2. net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
      3. net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
      3 frames
    5. IDEA
      Enhancer.firstInstance
      1. net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:640)
      2. net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
      2 frames
    6. Code Generation Library
      AbstractClassGenerator.create
      1. net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)
      1 frame
    7. IDEA
      Enhancer.create
      1. net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
      2. net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
      2 frames
    8. Spring AOP
      AbstractAutoProxyCreator.postProcessAfterInitialization
      1. org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:201)
      2. org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112)
      3. org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:476)
      4. org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:362)
      5. org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
      5 frames
    9. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1461)
      3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      5. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      6. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      7. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      8. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      9. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
      9 frames
    10. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
      2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
      2 frames
    11. Spring TestContext
      SpringJUnit4ClassRunner$1.runReflectiveCall
      1. org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
      2. org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
      3. org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
      4. org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
      5. org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
      6. org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
      7. org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
      8. org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
      9. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
      10. org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
      10 frames
    12. JUnit
      ReflectiveCallable.run
      1. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      1 frame
    13. Spring TestContext
      SpringJUnit4ClassRunner.runChild
      1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
      2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
      2 frames
    14. JUnit
      ParentRunner$2.evaluate
      1. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      2. org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      3. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      4. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      5. org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      6. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      6 frames
    15. Spring TestContext
      RunAfterTestClassCallbacks.evaluate
      1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
      2 frames
    16. JUnit
      ParentRunner.run
      1. org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      1 frame
    17. Spring TestContext
      SpringJUnit4ClassRunner.run
      1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
      1 frame
    18. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      1 frame
    19. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      5 frames