pissardl / geocoder-java

Automatically exported from code.google.com/p/geocoder-java
0 stars 0 forks source link

Using this with Google App Engine (GAE) #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
You can't use apache http commons 3.1 client with GAE. Do you have a version 
that works on GAE, b/c I can't seem to get it to work with out modifying your 
source.

My use:
Geocoder.setConnectionManager(new SimpleHttpConnectionManager());
    Geocoder geocoder = new Geocoder();
    GeocoderRequest geocoderRequest = new GeocoderRequestBuilder().setAddress(geocode).setLanguage("en").getGeocoderRequest();
    GeocodeResponse geocoderResponse = geocoder.geocode(geocoderRequest);

Exception thrown:
java.lang.NoClassDefFoundError: java.net.Socket is a restricted class. Please 
see the Google  App Engine developer's guide for more details.
    at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at com.google.code.geocoder.Geocoder.geocode(Geocoder.java:51)
    at com.gonevertical.server.db.Db_Feed_Geocode.geocode(Db_Feed_Geocode.java:89)
    at com.gonevertical.server.db.Db_Feed_Geocode.geocodeForThing(Db_Feed_Geocode.java:72)
    at com.gonevertical.server.db.Db_Feed_Spreadsheet.processGeocode(Db_Feed_Spreadsheet.java:890)
    at com.gonevertical.server.db.Db_Feed_Spreadsheet.geocodeColumn(Db_Feed_Spreadsheet.java:815)
    at com.gonevertical.server.db.Db_Spreadsheet.geocodeColumn_FromTask(Db_Spreadsheet.java:50)
    at com.gonevertical.server.servlet.Servlet_Task.startGeocoding(Servlet_Task.java:339)
    at com.gonevertical.server.servlet.Servlet_Task.doGet(Servlet_Task.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

Brandon Donnelson
http://gwt-examples.googlecode.com

Original issue reported on code.google.com by branflak...@gmail.com on 30 Jul 2011 at 5:42

GoogleCodeExporter commented 9 years ago
setConnectionManager(HttpConnectionManager manager) is marked as deprecated, so 
I assume there is a better way to use Geocoder in GAE.

The apache http classes are repackaged by Google - would be good if there was a 
way to use the repackaged classes instead of having another jar dependency.

import 
com.google.appengine.repackaged.org.apache.commons.httpclient.SimpleHttpConnecti
onManager;

Original comment by forbes...@gmail.com on 26 Aug 2011 at 3:17

GoogleCodeExporter commented 9 years ago
many thanks for your input

Original comment by panchmp on 26 Aug 2011 at 3:18

GoogleCodeExporter commented 9 years ago

Original comment by panchmp on 8 Feb 2012 at 8:24