我正在尝试处理JSON文件,但我不知道为什么会触发此异常。我正在使用示例代码,所以我不确定org.codehaus.jackson是如何工作的。
import java.io.File;
import skf.config.Configuration;
import skf.config.ConfigurationFactory;
import federate.ExcavatorFederate;
import federate.ExcavatorFederateAmbassador;
public class ExcavatorMain {
private static final File configurationFile = new File(
"testResources/configuration/conf.json");
public static void main(String[] args) {
System.out.println(configurationFile);
// TODO Auto-generated method stubz
ExcavatorFederateAmbassador fedamb = new ExcavatorFederateAmbassador();
ExcavatorFederate fed = new ExcavatorFederate(fedamb);
ConfigurationFactory factory = null;
Configuration config = null;
try {
factory = new ConfigurationFactory();
config = factory.importConfiguration(configurationFile);
fed.configureAndStart(config);
} catch (Exception e) {
e.printStackTrace();
}
}
}
例外情况是:
testResources\configuration\conf.json
Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.jackson.type.JavaType.<init>(Ljava/lang/Class;I)V
at org.codehaus.jackson.map.type.TypeBase.<init>(TypeBase.java:34)
at org.codehaus.jackson.map.type.SimpleType.<init>(SimpleType.java:46)
at org.codehaus.jackson.map.type.SimpleType.constructUnsafe(SimpleType.java:63)
at org.codehaus.jackson.map.ObjectMapper.<clinit>(ObjectMapper.java:183)
at skf.config.ConfigurationFactory.getObjectMapper(ConfigurationFactory.java:72)
at skf.config.ConfigurationFactory.importConfiguration(ConfigurationFactory.java:53)
at ExcavatorMain.main(ExcavatorMain.java:25)
我不明白。