rtudink

Calling a Locator in java processor - java.lang.NoSuchFieldError: DATE_PATTERNS

Discussion created by rtudink on Feb 14, 2014
Latest reply on Mar 21, 2014 by jdelgadillo-esristaff
Hi

I'm building a custom java processor calling a Locator service for geocoding, following the example given in
http://resources.arcgis.com/en/help/runtime-java/concepts/index.html#//01qv00000016000000

Using the following java code:
    Locator locator = new Locator(DEFUALT_LOCATOR_URL, credentials);
    LocatorFindParameters parameters = new LocatorFindParameters(ADDRESS);
    parameters.setMaxLocations(10); // number of results to return
    List<LocatorGeocodeResult> results = locator.find(parameters);


To get it compiling en running,  a dependency for HTTP client needs to be added to the POM,
the one also used in the ARCGIS 10.1.1 Runtime
   <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.2</version>
   </dependency>


However on calling the Locator find method the following exceptions is raised:
java.lang.NoSuchFieldError: DATE_PATTERNS
at com.esri.core.internal.io.handler.e.<init>(Unknown Source)
at com.esri.core.internal.io.handler.g.newInstance(Unknown Source)
at org.apache.http.cookie.CookieSpecRegistry.getCookieSpec(CookieSpecRegistry.java:110)
....
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1035)
at com.esri.core.internal.io.handler.l.a(Unknown Source)
at com.esri.core.internal.io.handler.l.a(Unknown Source)
at com.esri.core.internal.tasks.a.c.c.a(Unknown Source)
at com.esri.core.tasks.ags.geocode.Locator.find(Unknown Source)

Locally on my development PC,  I can resolve this exception by using an older httpclient version:
   <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.0</version>
   </dependency>

However on the target the exception still shows up in the karaf log en the GeoEvent processor effectively stops working.

Any hint on how to get this solved, or properly call a Locator within a java processor?

Thanks
Rob Udink

Outcomes