0

I am trying to process a JSON file, but I have no idea why this exception is being triggered. I am using sample code, so I am not sure how org.codehaus.jackson clearly works.

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();
        }
    }
}

The exceptions were:

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)

I don't get it.

  • 1
    Searching on this site reveals [a most likely answer](http://stackoverflow.com/questions/5094180/jackson-objectmapper-constructor-throws-nosuchmethod) – Anya Shenanigans Feb 07 '15 at 23:57
  • From what I understand, it seems like the Jackson JAR's are out of sync. Is there any way I can fix this problem in Eclipse? – Omar-Alfred Salah Feb 08 '15 at 00:16
  • It's difficult to tell from here - if you're using maven references, it can end up pulling in two different versions of jackson because of having explicit dependencies listed. There are several related questions and answers related to this on stackoverflow, so I would suggest searching here for ways of finding the answer you're looking for. – Anya Shenanigans Feb 08 '15 at 12:28

0 Answers0