flowable/flowable-engine · error · ActivitiIllegalArgumentException

resource ' + resource + ' doesn't exist

Error message

resource ' + resource + ' doesn't exist

What it means

ResourceStreamSource.getInputStream() resolves a classpath resource via the thread/classloader and throws ActivitiIllegalArgumentException when the resource cannot be found on the classpath (inputStream == null). It means the named resource string does not resolve to an existing classpath entry.

Solutions

  1. Confirm the resource exists under src/main/resources and is packaged in the artifact
  2. Print getClass().getResource(resource) to debug resolution and fix the path (with/without leading slash)
  3. Ensure the jar/war containing the resource is on the runtime classpath
  4. If loading from a filesystem path, use a FileStreamSource instead

Example fix

// before
StreamSource src = new ResourceStreamSource("bpmn/myProcess.xml"); // not on classpath
// after
StreamSource src = new ResourceStreamSource("org/acme/bpmn/myProcess.xml"); // matches packaged location
Defensive patterns

Strategy: validation

Validate before calling

// verify the resource resolves before constructing the source
String path = resource.startsWith("/") ? resource.substring(1) : resource;
if (Thread.currentThread().getContextClassLoader().getResource(path) == null) {
  throw new IllegalStateException("classpath resource missing: " + path);
}

Type guard

boolean classpathResourceExists(String resource) {
  return ReflectUtil.getResourceAsStream(resource) != null;
}

Try / catch

try {
  InputStream in = new ResourceStreamSource(resource).getInputStream();
} catch (ActivitiIllegalArgumentException e) {
  logger.error("resource not found on classpath: " + resource, e);
  // fail fast or load from filesystem fallback
}

Prevention

When it happens

Trigger: Creating a ResourceStreamSource for resource 'path/file' (with or without explicit classLoader) where getResourceAsStream returns null — the resource is absent from the classpath at runtime.

Common situations: Typo in the resource path; resource not packaged into the jar/war (missing from src/main/resources); leading slash misuse (classpath vs filesystem path); resource present in IDE but not in the deployed artifact.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/8654a14c08de1396. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/util/io/ResourceStreamSource.java:49

    public ResourceStreamSource(String resource) {
        this.resource = resource;
    }

    public ResourceStreamSource(String resource, ClassLoader classLoader) {
        this.resource = resource;
        this.classLoader = classLoader;
    }

    @Override
    public InputStream getInputStream() {
        InputStream inputStream = null;
        if (classLoader == null) {
            inputStream = ReflectUtil.getResourceAsStream(resource);
        } else {
            inputStream = classLoader.getResourceAsStream(resource);
        }
        if (inputStream == null) {
            throw new ActivitiIllegalArgumentException("resource '" + resource + "' doesn't exist");
        }
        return new BufferedInputStream(inputStream);
    }

    @Override
    public String toString() {
        return "Resource[" + resource + "]";
    }
}

View on GitHub (pinned to d6d39ce1c6)