Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gmaps4jsf V3.0.0在尝试反向地理编码时出现HTTP错误_Http_Jsf 2.2_Gmaps4jsf - Fatal编程技术网

Gmaps4jsf V3.0.0在尝试反向地理编码时出现HTTP错误

Gmaps4jsf V3.0.0在尝试反向地理编码时出现HTTP错误,http,jsf-2.2,gmaps4jsf,Http,Jsf 2.2,Gmaps4jsf,我试图在我的JSF2.x应用程序中使用Gmaps4jsf版本3.0.0。我想根据全球纬度和经度提取一些地方的地址。为此,我使用了以下代码: public static String addressGenerator(Double latitude, Double longitude){ String address = ""; try{ address = GMaps4JSFServiceFactory.getReverseGeocoderService().

我试图在我的JSF2.x应用程序中使用Gmaps4jsf版本3.0.0。我想根据全球纬度和经度提取一些地方的地址。为此,我使用了以下代码:

public static String addressGenerator(Double latitude, Double longitude){
    String address = "";
    try{
        address = GMaps4JSFServiceFactory.getReverseGeocoderService().
                getPlaceMark(latitude.toString(), longitude.toString()).getAddress();
        address = new String(address.getBytes(), "UTF-8");      
    } catch (Exception e){
        e.printStackTrace();
    }
    return address;
}
但是,它不起作用,我遇到了以下错误:

java.lang.Exception: Error: Server returned HTTP response code: 403 for URL: http://maps.google.com/maps/geo?q=41.13087,28.974647&output=json&sensor=false&key=abcdef

at com.googlecode.gmaps4jsf.services.ReverseGeocoderServiceImpl.getPlaceMark(ReverseGeocoderServiceImpl.java:73)

我遇到了同样的问题,我相信很多其他人也遇到了

根据谷歌关于此API的文档: “地理编码API的第2版(“v2”)于2010年3月8日被正式弃用,现已被拒绝。截至2013年9月9日,v2 API将不再工作。”

有关如何升级到版本3的信息,请参见

希望这有帮助:)