Announcement Announcement Module
Collapse
No announcement yet.
Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanCl assExcep Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanCl assExcep

    i get the following error when i run a simple spring AOP program in Eclipse.
    the XML file is

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

    <beans>

    <!--CONFIG-->
    <bean id="businesslogicbean"
    class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces">
    <value>IBusinessLogic</value>
    </property>
    <property name="target">
    <ref local="beanTarget"/>
    </property>
    <property name="interceptorNames">
    <list>
    <value>theTracingBeforeAdvisor</value>
    <value>theTracingAfterAdvisor</value>
    </list>
    </property>
    </bean>

    <!--CLASS-->
    <bean id="beanTarget"
    class="BusinessLogic"/>

    <!--ADVISOR-->
    <!--Note: An advisor assembles pointcuts and advice-->
    <bean id="theTracingBeforeAdvisor"
    class="org.springframework.aop.support.RegexpMetho dPointcutAdvisor">
    <property name="advice">
    <ref local="theTracingBeforeAdvice"/>
    </property>
    <property name="pattern">
    <value>.*</value>
    </property>
    </bean>

    <!--ADVISOR-->
    <!--Note: An advisor assembles pointcuts and advice-->
    <bean id="theTracingAfterAdvisor"
    class="org.springframework.aop.support.RegexpMetho dPointcutAdvisor">
    <property name="advice">
    <ref local="theTracingAfterAdvice"/>
    </property>
    <property name="pattern">
    <value>.*</value>
    </property>
    </bean>

    <!--ADVICE-->
    <bean id="theTracingBeforeAdvice"
    class="TracingBeforeAdvice"/>
    <bean id="theTracingAfterAdvice"
    class="TracingAfterAdvice"/>
    </beans>
    the error msg i get on running this example is

    log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
    log4j:WARN Please initialize the log4j system properly.
    Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanCl assException: Cannot find class [BusinessLogic] for bean with name 'beanTarget' defined in file [D:\MyAopProjects\AopSimple\springconfig.xml]; nested exception is java.lang.ClassNotFoundException: BusinessLogic

    Caused by: java.lang.ClassNotFoundException: BusinessLogic
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    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)
    at org.springframework.util.ClassUtils.forName(ClassU tils.java:177)
    at org.springframework.beans.factory.support.Abstract BeanDefinition.resolveBeanClass(AbstractBeanDefini tion.java:313)
    at org.springframework.beans.factory.support.Abstract BeanFactory.resolveBeanClass(AbstractBeanFactory.j ava:912)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanNamesForType(DefaultList ableBeanFactory.java:165)
    at org.springframework.context.support.AbstractApplic ationContext.getBeanNamesForType(AbstractApplicati onContext.java:687)
    at org.springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors(Abstr actApplicationContext.java:397)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:330)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:89)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:74)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:65)
    at com.springinaction.aop.MainApplication.main(MainAp plication.java:11)


    please help me..thanks in advance..

  • #2
    This is not an AOP problem.
    Your BusinessLogic class is nowhere to be found.
    Where is you BusinessLogic class? Is it in some package?

    Comment

    Working...
    X