Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

Thanks

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
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 '12 at 15:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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