我是靠谱客的博主 秀丽心情,这篇文章主要介绍java-No exception of type ConfigurationException can be thrown; an exception type must be a subclass,现在分享给大家,希望可以做个参考。

功能:读配置文件

java菜鸟:导入工程在报名处就开始报错,第一次遇到

import org.apache.commons.lang3.StringUtils;

import org.apache.commons.configuration.ConfigurationException;

package com.test;

The type org.apache.commons.lang.exception.NestableException cannot be resolved. It is indirectly referenced from required .class files

catch (ConfigurationException e)

No exception of type ConfigurationException can be thrown; an exception type must be a subclass of Throwable

 

原因:

http://hi.baidu.com/virackt/item/8534b95d49ce78d4d48bac4d

No exception of type ConfigurationException can be thrown; an exception type must be a subclass of Throwable

后来查了一下居然是因为这个类里面定义的configurationException是继承了lang里面的NestableException

要同时引入两个包才能使用这个类。貌似apache很多jar包都是相互牵连,用一个功能就得加载好几个包

由于lang3中已经没有NestableException这个异常类了,所以使用configuration会出现异常,所以改用lang2.6问题就解决了

总结:

使用configuration,要有对用版本lang才可以

最后

以上就是秀丽心情最近收集整理的关于java-No exception of type ConfigurationException can be thrown; an exception type must be a subclass的全部内容,更多相关java-No内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(132)

评论列表共有 0 条评论

立即
投稿
返回
顶部