Error creating bean with name "... "



  • I have the next Spring configuration.

    I'm making a mistake. Writing.

    Error creating bean with name "... "

    And depending on what's in my first place, then I'm id bin. He writes instead of a multitude. It's worth it. dataSource

    Error creating bean with name "dataSource."

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName" value="${db_driver}" />
        <property name="url" value="${db_url}" />
        <property name="username" value="${user}" />
        <property name="password" value="${password}" />
        <property name="initialSize" value="${initialSize}" />
        <property name="maxActive" value="${maxActive}" />
        <property name="maxIdle" value="${maxIdle}" />
    </bean>
    <context:property-placeholder location="classpath:jdbc.properties" />
    

    <bean id="authorDAO" class="com.dao.impl.AuthorDAOImpl">
    <property name="dataSource" ref="dataSource" />
    </bean>

    <bean id="commentDAO" class="com.dao.impl.CommentDAOImpl">
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean id="newsDAO" class="com.dao.impl.NewsDAOImpl">
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean id="tagDAO" class="com.dao.impl.TagDAOImpl">
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean id="authorService" class="com.service.impl.AuthorServiceImpl">
    <property name="authorDAO" ref="authorDAO" />
    </bean>

    <bean id="tagService" class="com.impl.TagServiceImpl">
    <property name="tagDAO" ref="tagDAO" />
    </bean>

    <bean id="commentService" class="com.impl.CommentServiceImpl">
    <property name="commentDAO" ref="commentDAO" />
    </bean>

    <bean id="newsService" class="com.service.impl.NewsServiceImpl">
    <property name="newsDAO" ref="newsDAO" />
    </bean>

    <bean id="transactionManagement"
    class="com.service.impl.TransactionManagementImpl">
    <property name="authorService" ref="authorService"/>
    <property name="tagService" ref="tagService"/>
    <property name="newsService" ref="newsService"/>
    <property name="commentService" ref="commentService"/>
    </bean>

    <!-- <context:annotation-config/> -->

    <bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
    </bean>

    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
    <tx:method name="addNews" />
    <tx:method name="deleteNews"/>
    </tx:attributes>
    </tx:advice>

    <aop:config>
    <aop:pointcut id="transactionOperation"
    expression="execution(* com.service.TransactionManagement.*(..))"/>
    <aop:advisor pointcut-ref="transactionOperation" advice-ref="txAdvice"/>
    </aop:config>

    <!-- these bean will be transactional -->

    Stacktress:

    java.lang.IllegalStateException: Failed to load ApplicationContext at
    org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
    at
    org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
    at
    org.springframework.test.context.support.DependencyInjectionExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
    at
    org.springframework.test.context.support.DependencyInjectionExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
    at
    org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228)
    at
    org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230) at
    org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
    at
    org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at
    org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
    at
    org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249)
    at
    org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at
    org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at
    org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at
    org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at
    org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at
    org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at
    org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at
    org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
    at
    org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at
    org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    Caused by: org.springframework.beans.factory.BeanCreationException:
    Error creating bean with name 'dataSource' defined in class path
    resource [testSpringContext.xml]: BeanPostProcessor before
    instantiation of bean failed; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0':
    Initialization of bean failed; nested exception is
    java.lang.NoClassDefFoundError:
    org/aspectj/weaver/reflect/Reflection World$Reflection WorldException
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:478)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at
    org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at
    org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at
    org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:835)
    at
    org.springframework.context.support.AbstractApplicationContext.resh(AbstractApplicationContext.java:537)
    at
    org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:125)
    at
    org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
    at
    org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:109)
    at
    org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:261)
    at
    org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
    at
    org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
    ... 25 more Caused by:
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0':
    Initialization of bean failed; nested exception is
    java.lang.NoClassDefFoundError:
    org/aspectj/weaver/reflect/Reflection World$Reflection WorldException
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at
    org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:201)
    at
    org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:92)
    at
    org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:101)
    at
    org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:103)
    at
    org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:243)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:988)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:959)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:472)
    ... 38 more Caused by: java.lang.NoClassDefFoundError:
    org/aspectj/weaver/reflect/Reflection World$Reflection WorldException
    at java.lang.Class.getDeclaredMethods0(Native Method) at
    java.lang.Class.privateGetDeclaredMethods(Unknown Source) at
    java.lang.Class.getDeclaredMethods(Unknown Source) at
    org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:606)
    at
    org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:518)
    at
    org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:504)
    at
    org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1069)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at
    org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    at
    org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    ... 50 more Caused by: java.lang.ClassNotFoundException:
    org.aspectj.weaver.reflect.Reflection World$Reflection WorldException
    at java.net.URLClassLoader.findClass(Unknown Source) at
    java.lang.ClassLoader.loadClass(Unknown Source) at
    sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at
    java.lang.ClassLoader.loadClass(Unknown Source) ... 68 more



  • A library should be added to deal with this problem! AspectJ Weaver.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2