I have an application that references a JAR file. In that JAR file, I have a method that creates a Coordinate Reference System using the CRS class. This class is Project_Point. When I run and test this class, everything works fine. But when I bring it into another application, I get errors with the CRS class.

   sourceWKT = sourceWKTArg;

    targetWKT = targetWKTArg;
   //crashes here with error Exception in thread "main" java.lang.NoSuchMethodError: org.geotools.referencing.CRS.getAuthorityFactory(Z)Lorg/opengis/referencing/crs/CRSAuthorityFactory;
    CRSAuthorityFactory factory =  CRS.getAuthorityFactory(true);

    //crashes here with errors about EPSG code not found
    sourceCRS = CRS.parseWKT(sourceWKT);
    sourceCRS = CRS.decode("EPSG:4326");

Again, when I run this code from the class, everything is fine.

Could this be happening because the application I'm trying to use this class in is version 2.2 of geotools and this class is written in 2.7? If so, whats a work around for this?


1 Answer 1


It's hard to tell exactly what is going on with out seeing more of the code and the actual error message.

But mixing version 2.2 and version 2.7 of GeoTools is unlikely to work well. Try using just 2.7 classes (2.2 is very old and you're unlikely to find any one who remembers too much about how it works or feels like fixing it if you have found a bug).

One final thing to check is that you have included the gt-epsg-xxxx jar as well as gt-referencing - see the CRS Tutorial for more details of set up.

  • Yeah, mixing API version isn't going to work, so I found a work around for this project. Thanks for the reply.
    – user5817
    Mar 15, 2012 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.