java.lang.IllegalStateException: Failed to load ApplicationContext

tistory.com | 2 months ago
  1. 0

    Whiteship's Note :: 'Spring' 카테고리의 글 목록 (4 Page)

    tistory.com | 2 months ago
    java.lang.IllegalStateException: Failed to load ApplicationContext
  2. 0

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name... (Spring forum at Coderanch)

    coderanch.com | 6 months ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [/media/vol0/dev/hoiocard/target/hoiocard/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cat.innoments.s2.dao.jpa.impl.UserDaoImpl]: No default constructor found; nested exception is java.lang.NoSuchMethodException: cat.innoments.s2.dao.jpa.impl.UserDaoImpl.<init>()
  3. 0

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name... (Spring forum at JavaRanch)

    coderanch.com | 1 year ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [/media/vol0/dev/hoiocard/target/hoiocard/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cat.innoments.s2.dao.jpa.impl.UserDaoImpl]: No default constructor found; nested exception is java.lang.NoSuchMethodException: cat.innoments.s2.dao.jpa.impl.UserDaoImpl.<init>()
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    It's easy to forget that nested @Configuration classes must be static. For example: public class AClass { @Configuration public class InnerConfig { public @Bean String name() { return "foo"; } } } Is an invalid @Configuration because it's a member class. CGLIB cannot instantiate this class, and the resulting error is opaque: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SanityCheck$AClass$InnerConfig': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [SanityCheck$AClass$InnerConfig$$EnhancerByCGLIB$$eadebd51]: No default constructor found; nested exception is java.lang.NoSuchMethodException: SanityCheck$AClass$InnerConfig$$EnhancerByCGLIB$$eadebd51.<init>() at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:881) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:837) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.config.java.context.JavaConfigApplicationContext.<init>(JavaConfigApplicationContext.java:81) at SanityCheck.main(SanityCheck.java:12) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [SanityCheck$AClass$InnerConfig$$EnhancerByCGLIB$$eadebd51]: No default constructor found; nested exception is java.lang.NoSuchMethodException: SanityCheck$AClass$InnerConfig$$EnhancerByCGLIB$$eadebd51.<init>() at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:58) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:875) ... 15 more Caused by: java.lang.NoSuchMethodException: SanityCheck$AClass$InnerConfig$$EnhancerByCGLIB$$eadebd51.<init>() at java.lang.Class.getConstructor0(Class.java:2678) at java.lang.Class.getDeclaredConstructor(Class.java:1953) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54) ... 16 more Far better would be to see the usual MalformedJavaConfigurationException with a user-friendly error message. This treatment should apply to local classes and member classes. It will require propagating information from class literals passed into JavaConfig[Web]ApplicationContext down through the model (ConfigurationClass). Moderate effort, nothing too big.

    Spring JIRA | 8 years ago | Chris Beams
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SanityCheck$AClass$InnerConfig': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [SanityCheck$AClass$InnerConfig$$EnhancerByCGLIB$$eadebd51]: No default constructor found; nested exception is java.lang.NoSuchMethodException: SanityCheck$AClass$InnerConfig$$EnhancerByCGLIB$$eadebd51.<init>()
  6. 0

    NamedParameterJdbcTemplate Exception - Spring Forum

    spring.io | 4 months ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplate' defined in class path resource [springWithJDBC.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.<init>()

  1. empt-ak 1 times, last 1 month ago
  2. Luka 12 times, last 2 months ago
  3. andyglick 28 times, last 2 months ago
  4. ruifung 1 times, last 3 months ago
  5. Shadd518 1 times, last 4 months ago
8 more registered users
47 unregistered visitors
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.NoSuchMethodException

    org.opensprout.sandbox.proxy.withfinal.FinalHello.<init>()

    at java.lang.Class.getConstructor0()
  2. Java RT
    Class.getDeclaredConstructor
    1. java.lang.Class.getConstructor0(Class.java:2706)
    2. java.lang.Class.getDeclaredConstructor(Class.java:1985)
    2 frames
  3. Spring Beans
    AbstractAutowireCapableBeanFactory$1.run
    1. org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
    4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
    5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    5 frames
  4. Java RT
    AccessController.doPrivileged
    1. java.security.AccessController.doPrivileged(Native Method)
    1 frame
  5. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    2. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    3. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
    4. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    5. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    6. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    7. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    7 frames
  6. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
    2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
    2 frames
  7. Spring TestContext
    SpringJUnit4ClassRunner.invokeTestMethod
    1. org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
    2. org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:42)
    3. org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:173)
    4. org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:199)
    5. org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
    6. org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
    7. org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
    8. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:93)
    9. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:130)
    9 frames
  8. JUnit
    JUnit4ClassRunner.run
    1. org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    2. org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    3. org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    4. org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    5. org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    5 frames
  9. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
    1 frame
  10. 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:460)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    5 frames