Hello all,
I am trying to retrieve the country details using clickstream data for which I have downloaded the GeoLite2-Country database. I have made the following modifications in my configuration files:
1. divolte-collector.conf
divolte{
global{
mapper{
ip2geo_database = "/path-to/divolte/ip2geo/GeoLite2-Country.mmdb" }
}
}
2. mapping.groovy
def ua = ip2geo() //by default it will take the remoteHost
map ua.countryName() onto 'countryNameField'3. MyEventRecord.avsc
{
"namespace": "io.divolte.examples.record",
"type": "record",
"name": "MyEventRecord",
"fields": [
{ "name": "countryNameField", "type": ["null", "string"], "default": null } ]
}
Once the ip2geo() function is called when a page is loaded, it throws the following error:
Caused by: java.lang.UnsupportedOperationException: Invalid attempt to open a GeoLite2-Country database using the city methodTurns out that it was trying to access
com.maxmind.geoip2.DatabaseReader.city() function instead of country() function.
Caused by: java.lang.UnsupportedOperationException: Invalid attempt to open a GeoLite2-Country database using the city method
at com.maxmind.geoip2.DatabaseReader.get(DatabaseReader.java:150)
at com.maxmind.geoip2.DatabaseReader.city(DatabaseReader.java:206)
at io.divolte.server.ip2geo.DatabaseLookupService.lookup(DatabaseLookupService.java:81)
On looking further into
io.divolte.server.ip2geo.DatabaseLookupService, there is class only to collect the
CityResponse and not the CountryResponse. | import com.maxmind.db.ClosedDatabaseException; |
| import com.maxmind.geoip2.DatabaseReader; |
| import com.maxmind.geoip2.exception.GeoIp2Exception; |
import com.maxmind.geoip2.model.CityResponse;
Can anyone pls let me know is this the reason why I am not getting any country details? How can the issue be solved so that I can get the country name?
No issues were found in executing when I use GeoLite2-City.mmdb database.