apache/seatunnel · error · SeaTunnelRuntimeException

REFLECT_CLASS_OPERATION_FAILED

REFLECT_CLASS_OPERATION_FAILED

Error message

REFLECT_CLASS_OPERATION_FAILED

What it means

FileUtils.searchJarFiles converts directory paths to URLs while scanning for .jar files. A MalformedURLException (e.g. a malformed/unusable path-to-URI conversion) is rethrown as a SeaTunnelRuntimeException with code REFLECT_CLASS_OPERATION_FAILED.

Source

Thrown at seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/FileUtils.java:59

import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@Slf4j
public class FileUtils {

    public static List<URL> searchJarFiles(@NonNull Path directory) throws IOException {
        if (!directory.toFile().exists()) {
            return new ArrayList<>();
        }
        try (Stream<Path> paths = Files.walk(directory, FileVisitOption.FOLLOW_LINKS)) {
            return paths.filter(path -> path.toString().endsWith(".jar"))
                    .map(
                            path -> {
                                try {
                                    return path.toUri().toURL();
                                } catch (MalformedURLException e) {
                                    throw new SeaTunnelRuntimeException(
                                            CommonErrorCodeDeprecated
                                                    .REFLECT_CLASS_OPERATION_FAILED,
                                            e);
                                }
                            })
                    .collect(Collectors.toList());
        }
    }

    public static String readFileToStr(Path path) {
        try {
            byte[] bytes = Files.readAllBytes(path);
            return new String(bytes);
        } catch (IOException e) {
            throw CommonError.fileOperationFailed("SeaTunnel", "read", path.toString(), e);
        }
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Fix the plugin/install directory path so it is a valid absolute filesystem path
  2. Check SEATUNNEL_HOME and connector/plugin path env vars for typos or illegal characters
  3. Inspect the wrapped MalformedURLException (cause) for the exact offending URL/path and correct it

Example fix

// before
export SEATUNNEL_HOME=/opt/sea tunnel/  # space breaks URL
// after
export SEATUNNEL_HOME=/opt/seatunnel/
Defensive patterns

Strategy: try-catch

Validate before calling

Path p = Paths.get(dir);
if (!Files.isDirectory(p)) throw new IllegalArgumentException("not a directory: " + p);

Try / catch

try { List<URL> jars = FileUtils.searchJarFiles(dir); } catch (SeaTunnelRuntimeException e) { log.error("bad plugin path: {}", e.getCause()); throw e; }

Prevention

When it happens

Trigger: Calling FileUtils.searchJarFiles(...) on a path whose toUri().toURL() conversion fails — typically due to a malformed plugin path, illegal characters, or an unusable filesystem entry.

Common situations: SEATUNNEL_HOME/plugins directory path containing spaces or invalid characters on odd setups; broken symlink or corrupted install dir; custom plugin dirs configured with invalid paths.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/9483eb4d5e198d91. Report an issue: GitHub.