log4j:WARN No appenders could be found for logger

log4j:WARN No appenders could be found for logger

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

在这个demo2测试里出错,WHY?

    @Test

    /*  spring method to impl */

    public void demo2() {

        //create spring factory

        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");

        //get clas from factory

        UserService userService=(UserService)applicationContext.getBean("userService");

        userService.sayHello();

    }


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
提问者 慕的地5408112 2019-10-21 22:38:34

老师好,课程中有上述提示,但能输出正常,

我的没有后面的输出了,后面都是错误。

完整输出如下:

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.



org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 7 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 9; XML document structures must start and end within the same entity.


at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)

at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)

删除了一些提示》》》》》》》》》》》》》》》》》

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)

... 77 more




Process finished with exit code 255


  • 提问者 慕的地5408112 #1
    可以了,是配置文件错误!
    2019-10-21 22:57:11
  • 好帮手慕柯南 回复 提问者 慕的地5408112 #2
    好的同学,同学自己找的了问题,给你点赞,加油,祝学习愉快~
    2019-10-22 09:58:00
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师