使用junit測試程序過程中出現的問題及解決方法

本文记录了一次使用Spring框架过程中遇到的多个配置异常问题及解决过程。从BeanDefinitionStoreException异常开始,逐步解决了因缺少DOM解析相关jar包导致的一系列NoClassDefFoundError错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

與行一個空的TestCase

第一個異常

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/fs/webapp/WEB-INF/classes/bean-config.xml]; nested exception is javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found

在我下載了dom3-xercesImpl-2002-08-17.jar之後,將它放到類路徑下,上面的異常沒有了,出現了下面的異常.

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/F:/MyFile/work-source/CaiWu/Workspace/financial/webapp/WEB-INF/classes/bean-config.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS

我又下載了xerces-2.4.0-2003-03-27.jar, 將它放到類路徑下,上面的異常沒有了,出現了下面的異常.

[org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException

我又下載了dom4j-1.6-2005-04-15.jar, 將它放到類路徑下,上面的異常沒有了,出現的是green bar.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值