• Eclipse 报错 org.springframework.context.support.AbstractApplicationContext refresh处理


    报错情况

    1月 08, 2021 6:14:16 下午 org.springframework.context.support.AbstractApplicationContext refresh
    警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [beanPostProcessorExample] for bean with name 'helloWorld' defined in class path resource [Beans.xml]; nested exception is java.lang.ClassNotFoundException: beanPostProcessorExample
    Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [beanPostProcessorExample] for bean with name 'helloWorld' defined in class path resource [Beans.xml]; nested exception is java.lang.ClassNotFoundException: beanPostProcessorExample
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1382)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:663)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:630)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1491)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1014)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:828)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:865)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:548)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
        at beanPostProcessorExample.MainApp.main(MainApp.java:7)
    Caused by: java.lang.ClassNotFoundException: beanPostProcessorExample
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:275)
        at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:437)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1430)
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1374)
        ... 10 more

     工程文件

    错误原因

    在看到报错信息中

    java.lang.ClassNotFoundException: beanPostProcessorExample

    我查看了所有用到该包的代码,最后发现Beans.xml中的class属性缺失类名

     于是我补充了类名

    运行成功!

     

    结论:查看错误信息内造成原因(Caused by ...),如果是缺失类,可以查看所有用到类的代码,添加即可。

  • 相关阅读:
    ORACLE 递归查询(转)
    J2EE框架(TomcatStrutsHibernateSpringAjax(dojo))开发步骤
    java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter 异常解决办法
    Oracle WebCenter 11g 快速开发指南翻译(二)
    keytool密钥和证书管理工具使用详解(整理)
    内存溢出异常解决方案总结
    Spring+JDBC组合开发
    Oracle WebCenter 11g 快速开发指南翻译(三)
    SQL SERVER 2005 数据挖掘与商业智能完全解决方案学习笔记(一)
    MyEclipse 打开Struts配置文件时出错的终级解决办法
  • 原文地址:https://www.cnblogs.com/yingluochaosheng/p/14252867.html
Copyright © 2020-2023  润新知