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


功能:讀配置文件

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才可以

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM