apereo/cas · warning

Geo-locating an address by latitude/longitude

Error message

Geo-locating an address by latitude/longitude [{}]/[{}] is not supported

What it means

MaxmindDatabaseGeoLocationService only implements geolocation by IP address. The locate(Double latitude, Double longitude) overload is explicitly unsupported and always logs this warning and returns null. Callers requesting coordinate-based lookup get no result by design.

Solutions

  1. Use address/IP-based geolocation instead of coordinates with this service
  2. Implement a custom GeoLocationService that supports lat/long (e.g. backed by a different API) if coordinate lookup is required
  3. Do not route coordinate-based geolocation requests to the Maxmind database service

Example fix

// before
geoLocationService.locate(40.7128, -74.0060); // always null
// after
geoLocationService.locate(InetAddress.getByName("8.8.8.8"));
Defensive patterns

Strategy: type-guard

Validate before calling

if (geoService instanceof MaxmindDatabaseGeoLocationService) {
    LOGGER.warn("coordinate lookup unsupported; use IP/address lookup");
}

Type guard

boolean supportsCoordinateLookup(GeoLocationService s) { return !(s instanceof MaxmindDatabaseGeoLocationService); }

Prevention

When it happens

Trigger: Any code path (e.g. geolocation service invocations from adaptive authentication or user-profile flows) that calls locate(latitude, longitude) against the Maxmind-backed service.

Common situations: Modules or custom code that assume all GeoLocationService implementations support coordinate lookup; switching the configured geolocation provider from a coordinate-capable one to the Maxmind IP database.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08). Data as JSON: /api/errors/93f8cccc9aff1e2f. Report an issue: GitHub.

Appendix: source

Thrown at support/cas-server-support-geolocation-maxmind/src/main/java/org/apereo/cas/support/geo/maxmind/MaxmindDatabaseGeoLocationService.java:81

                collectGeographicalPosition(location, cityResponse);

                val countryResponse = client.country(address);
                location.addAddress(countryResponse.country().name());
            }

            LOGGER.debug("Geo location for [{}] is calculated as [{}]", address, location);
            return location;
        } catch (final AddressNotFoundException e) {
            LOGGER.info(e.getMessage(), e);
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        }
        return null;
    }

    @Override
    public @Nullable GeoLocationResponse locate(final Double latitude, final Double longitude) {
        LOGGER.warn("Geo-locating an address by latitude/longitude [{}]/[{}] is not supported", latitude, longitude);
        return null;
    }

    protected WebServiceClient buildWebServiceClient() {
        return Optional.ofNullable(this.webServiceClient).orElseGet(
            () -> new WebServiceClient.Builder(properties.getAccountId(), properties.getLicenseKey())
                .host("geolite.info")
                .requestTimeout(Duration.ofSeconds(5))
                .proxy(ProxySelector.getDefault())
                .build());
    }

    private static void collectGeographicalPosition(final GeoLocationResponse location,
                                                    final CityResponse response) {
        val loc = response.location();
        if (loc != null) {
            if (loc.latitude() != null) {
                location.setLatitude(loc.latitude());

View on GitHub (pinned to e7288fc434)