日期:2014-05-20  浏览次数:49481 次

new ClassPathXmlApplicationContext时出异常
Java code
ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml");

是抛异常
这是异常信息:
Java code
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:145)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:84)
    at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init>(AbstractRefreshableConfigApplicationContext.java:59)
    at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:58)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:136)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.springmodel.A.main(A.java:14)


这是beans.xml中的信息
Java code
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    <bean id="moni" class="com.springmodel.Moni">
        <property name="mi" value="测试IC" />
    </bean>
</beans>


------解决方案--------------------
org/apache/commons/logging这个包有没有加上?
------解决方案--------------------
探讨

org/apache/commons/logging这个包有没有加上?