我正在尝试将 MaxMind java 库与 ColdFusion 一起使用。
我开始在 MaxMind 官方网站上转换此示例代码:
// A File object pointing to your GeoIP2 or GeoLite2 database
File database = new File("/path/to/GeoIP2-City.mmdb");
// This creates the DatabaseReader object, which should be reused across
// lookups.
DatabaseReader reader = new DatabaseReader.Builder(database).build();
InetAddress ipAddress = InetAddress.getByName("128.101.101.101");
// Replace "city" with the appropriate method for your database, e.g.,
// "country".
CityResponse response = reader.city(ipAddress);
Country country = response.getCountry();
我试过的是:
var file = "pathto\maxmind\GeoLite2-City.mmdb";
var db = createObject("java","java.io.File").init(file);
var mm = createObject("java", "com.maxmind.geoip2.DatabaseReader")
.Builder(db)
.build();
dump(c);abort;
我收到了这个错误:
Type: java.lang.NoSuchMethodException
Messages: No matching Method for Builder(java.io.File) found
for com.maxmind.geoip2.DatabaseReader
我做错了什么?