功能:讀配置文件
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才可以