apache/beam · error · RuntimeException
Standard logical type
Error message
Standard logical type '%s' has a zero-argument constructor, but it is not accessible.
What it means
If the logical type class has a zero-argument constructor that is not accessible (IllegalAccessException during getConstructor().newInstance()), SchemaTranslation throws RuntimeException 'has a zero-argument constructor, but it is not accessible'.
Solutions
- Make the no-arg constructor public.
- With JPMS, add opens/exports for the package or pass --add-opens <module>/<package>=ALL-UNNAMED.
- Register a public implementation class for the URN instead of a hidden one.
- Catch the RuntimeException when decoding and surface a clear schema compatibility error.
Example fix
// before
private IdLogicalType(){}
// after
public IdLogicalType(){} Defensive patterns
Strategy: validation
Validate before calling
java.lang.reflect.Constructor<?> c = logicalTypeClass.getConstructor();
if (!java.lang.reflect.Modifier.isPublic(c.getModifiers())
|| !java.lang.reflect.Modifier.isPublic(logicalTypeClass.getModifiers()))
throw new IllegalStateException("No-arg constructor not accessible"); Prevention
- Make no-arg constructors public.
- In JPMS apps, open the containing package (--add-opens or module-info opens).
- Avoid singleton private constructors on logical types registered by URN.
- Verify reflective instantiation in unit tests.
When it happens
Trigger: Decoding an argument-less logical type whose no-arg constructor is private/package-private, or whose class lives in a JPMS module that does not open its package.
Common situations: Singleton-style logical types with private constructors; modularized apps without --add-opens; builders used instead of public constructors.
Related errors
- Standard logical type
- AutoValue builder class
- Can not call prepareRun
- cannot register Coder : does not have an accessible method…
- cannot register Coder : method named 'of' with arguments…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/a60698198cc8b08b.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/SchemaTranslation.java:455
e);
} catch (InvocationTargetException e) {
throw new RuntimeException(
String.format(
"Error instantiating logical type '%s' with of('%s') method.",
urn, objectName),
e);
}
} else {
// Logical type without argument. Construct from constructor without parameter
try {
return FieldType.logicalType(logicalTypeClass.getConstructor().newInstance());
} catch (NoSuchMethodException e) {
throw new RuntimeException(
String.format(
"Standard logical type '%s' does not have a zero-argument constructor.", urn),
e);
} catch (IllegalAccessException e) {
throw new RuntimeException(
String.format(
"Standard logical type '%s' has a zero-argument constructor, but it is not accessible.",
urn),
e);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(
String.format(
"Error instantiating logical type '%s' with zero-argument constructor.", urn),
e);
}
}
}
// Special-case for DATETIME and DECIMAL which are logical types in portable representation,
// but not yet in Java. (https://github.com/apache/beam/issues/19817)
if (urn.equals(URN_BEAM_LOGICAL_MILLIS_INSTANT)) {
return FieldType.DATETIME;
} else if (urn.equals(URN_BEAM_LOGICAL_DECIMAL)) {
return FieldType.DECIMAL;View on GitHub (pinned to 12126d8942)