alibaba/DataX · error · IllegalArgumentException
class={x}
Error message
class={x} What it means
Thrown by ColumnDataType.getTypeFromClass(Class<?> x) when the Java class of a value being written is not any of the recognized classes (String, numeric wrappers, BigDecimal, Date/Time/Timestamp). The final else branch raises IllegalArgumentException('class=' + x), i.e. the writer received a Java object type it cannot map to an ADS value type.
Source
Thrown at adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/ads/ColumnDataType.java:296
return BYTE;
} else if (Short.class == x) {
return SHORT;
} else if (Float.class == x) {
return FLOAT;
// } else if (Void.class == x) {
// return NULL;
} else if (BigDecimal.class.isAssignableFrom(x)) {
return DECIMAL;
} else if (Date.class.isAssignableFrom(x)) {
return DATE;
} else if (Time.class.isAssignableFrom(x)) {
return TIME;
} else if (Timestamp.class.isAssignableFrom(x)) {
return TIMESTAMP;
} else if (java.util.Date.class.isAssignableFrom(x)) {
return TIMESTAMP;
} else {
throw new IllegalArgumentException("class=" + x);
}
}
/**
* Convert primitive class names to java.lang.* class names.
*
* @param clazz the class (for example: int)
* @return the non-primitive class (for example: java.lang.Integer)
*/
public static Class<?> getNonPrimitiveClass(Class<?> clazz) {
if (!clazz.isPrimitive()) {
return clazz;
} else if (clazz == boolean.class) {
return Boolean.class;
} else if (clazz == byte.class) {
return Byte.class;
} else if (clazz == char.class) {
return Character.class;View on GitHub (pinned to 80ec23d5c5)
Solutions
- Read the class name from the exception message and find which column/reader emits that type.
- Convert the value upstream to a supported type (String, java.util.Date, BigDecimal, numeric wrappers) before it reaches the writer.
- Exclude the offending column or cast it to string in the reader's column configuration.
- If the class is a legit new type (e.g. java.time.LocalDate), add a branch mapping it and rebuild the plugin.
Example fix
// before Object v = java.time.LocalDate.now(); // class=java.time.LocalDate -> throw // after Object v = java.sql.Date.valueOf(java.time.LocalDate.now()); // supported
Defensive patterns
Strategy: type-guard
Validate before calling
boolean isSupportedValueClass(Object v) {
return v == null || v instanceof String || v instanceof Boolean
|| v instanceof Byte || v instanceof Short || v instanceof Integer || v instanceof Long
|| v instanceof Float || v instanceof Double || v instanceof BigDecimal
|| v instanceof java.util.Date;
} Type guard
Class<?> normalizeClass(Object v) {
if (v instanceof java.time.LocalDate) return java.sql.Date.class;
if (v instanceof java.time.Instant) return java.sql.Timestamp.class;
return v == null ? null : v.getClass();
} Try / catch
try {
int vt = ColumnDataType.getTypeFromClass(x);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("unsupported column value class " + e.getMessage()
+ " - convert to String/Date/BigDecimal/boxed primitive first", e);
} Prevention
- Convert java.time.* and byte[] values to JDBC-supported types at the reader/transformer boundary.
- Do not pass domain objects through to the insert proxy - stringify them first.
- Log the value class for each column type once during development to catch unsupported classes early.
When it happens
Trigger: Calling setObject-style paths (or column conversion logic that reflects on value classes) with instances whose class is outside the supported set - e.g. byte[], Boolean is fine but arrays, Calendar, java.time.LocalDate, enums, or custom classes are not.
Common situations: A reader plugin produces java.time.* values or byte arrays that the adswriter version predates, or user code in a transformer returns an arbitrary object which is forwarded to the insert proxy.
Related errors
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/288180126f478eca.
Report an issue: GitHub.