我编写了一个“java”程序来使用地理编码获取给定邮政编码的坐标(纬度和经度)。我在家中测试了该程序,它运行良好,但是当我在办公室运行相同的程序时,它会抛出“网络错误”。堆栈跟踪如下所示。
[2012-10-04 10:50:34.337 MESZ] [main] 错误 com.google.code.geocoder.Geocoder - 连接被拒绝:连接 java.net.ConnectException:连接被拒绝:在 java.net.DualStackPlainSocketImpl.connect0 连接(本机方法)~[na:1.7.0_03] at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69) ~[na:1.7.0_03] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)~ [na:1.7.0_03] 在 java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) ~[na:1.7.0_03] 在 java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) ~[na:1.7 .0_03] 在 java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157) ~[na:1.7.0_03] 在 java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) ~[na:1.7.0_03] 在java.net.Socket。connect(Socket.java:579) ~[na:1.7.0_03] at java.net.Socket.connect(Socket.java:528) ~[na:1.7.0_03] at sun.net.NetworkClient.doConnect(NetworkClient. java:180) ~[na:1.7.0_03] 在 sun.net.www.http.HttpClient.openServer(HttpClient.java:388) ~[na:1.7.0_03] 在 sun.net.www.http.HttpClient。 openServer(HttpClient.java:483) ~[na:1.7.0_03] at sun.net.www.http.HttpClient.(HttpClient.java:213) ~[na:1.7.0_03] at sun.net.www.http .HttpClient.New(HttpClient.java:300) ~[na:1.7.0_03] 在 sun.net.www.http.HttpClient.New(HttpClient.java:316) ~[na:1.7.0_03] 在 sun.net .www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:992) ~[na:1.7.0_03] at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:928) ~[na: 1.7.0_03] 在 sun.net.www.protocol.http.HttpURLConnection。connect(HttpURLConnection.java:846) ~[na:1.7.0_03] 在 sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1296) ~[na:1.7.0_03] 在 java.net。 URL.openStream(URL.java:1035) ~[na:1.7.0_03] at com.google.code.geocoder.Geocoder.request(Geocoder.java:72) ~[geocoder-java-0.9.jar:na] at com.google.code.geocoder.Geocoder.geocode(Geocoder.java:63) ~[geocoder-java-0.9.jar:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.getGeoResults (GoogleGeoLocation.java:36) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation。(GoogleGeoLocation.java:21) [lib/:na] 在 de.dmc。 intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.main(GoogleGeoLocation.java:67) [lib/:na]HttpURLConnection.getInputStream(HttpURLConnection.java:1296) ~[na:1.7.0_03] at java.net.URL.openStream(URL.java:1035) ~[na:1.7.0_03] at com.google.code.geocoder。 Geocoder.request(Geocoder.java:72) ~[geocoder-java-0.9.jar:na] at com.google.code.geocoder.Geocoder.geocode(Geocoder.java:63) ~[geocoder-java-0.9.jar :na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.getGeoResults(GoogleGeoLocation.java:36) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app .capi.GoogleGeoLocation.(GoogleGeoLocation.java:21) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.main(GoogleGeoLocation.java:67) [lib/:na ]HttpURLConnection.getInputStream(HttpURLConnection.java:1296) ~[na:1.7.0_03] at java.net.URL.openStream(URL.java:1035) ~[na:1.7.0_03] at com.google.code.geocoder。 Geocoder.request(Geocoder.java:72) ~[geocoder-java-0.9.jar:na] at com.google.code.geocoder.Geocoder.geocode(Geocoder.java:63) ~[geocoder-java-0.9.jar :na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.getGeoResults(GoogleGeoLocation.java:36) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app .capi.GoogleGeoLocation.(GoogleGeoLocation.java:21) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.main(GoogleGeoLocation.java:67) [lib/:na ]请求(Geocoder.java:72)~[geocoder-java-0.9.jar:na] at com.google.code.geocoder.Geocoder.geocode(Geocoder.java:63)~[geocoder-java-0.9.jar:na] ] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.getGeoResults(GoogleGeoLocation.java:36) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi .GoogleGeoLocation.(GoogleGeoLocation.java:21) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.main(GoogleGeoLocation.java:67) [lib/:na]请求(Geocoder.java:72)~[geocoder-java-0.9.jar:na] at com.google.code.geocoder.Geocoder.geocode(Geocoder.java:63)~[geocoder-java-0.9.jar:na] ] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.getGeoResults(GoogleGeoLocation.java:36) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi .GoogleGeoLocation.(GoogleGeoLocation.java:21) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.main(GoogleGeoLocation.java:67) [lib/:na]21) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.main(GoogleGeoLocation.java:67) [lib/:na]21) [lib/:na] 在 de.dmc.intersport.enfinity.ch.b2c.app.capi.GoogleGeoLocation.main(GoogleGeoLocation.java:67) [lib/:na]
我认为这是“防火墙设置”的问题。我能做些什么来摆脱这个。任何帮助将不胜感激