We are using a custom implementation of the Address class in our JGroups setup. When combining this custom address format with JDBC_PING2, we encounter a data insertion error at runtime.
The error log is as follows:
JDBC_PING2.error:99]21:250529140510: failed writing to DB: java.sql.SQLIntegrityConstraintViolationException: Column 'address' cannot be null
The root cause appears to be in the following method in JDBC_PING2:
public static String addressToString(Address addr) {
if (addr == null)
return null;
if (addr.isSiteAddress())
Class<? extends Address> cl = addr.getClass();
if (UUID.class.isAssignableFrom(cl)) // UUID, FlagsUUID, ExtendedUUID
return String.format("%s%s", UUID_PREFIX, ((UUID) addr).toStringLong());
if (IpAddress.class.equals(cl))
return String.format("%s%s", IP_PREFIX, addr);
return null;
}
Since our custom Address class does not fall into any of the known types (UUID, SiteUUID, or IpAddress), this method returns null. As a result, the address column in the database ends up being null, causing a SQL error