flowable/flowable-engine · error

Bundle cannot be generated

Error message

Bundle cannot be generated

What it means

When a 'bar:' URL is opened, BarURLHandler streams a synthetic OSGi bundle generated from the BAR's bar-deployment.xml via BarTransformer.transform. If transformation throws for any reason, the writer thread logs 'Bundle cannot be generated' so the caller sees an empty/failed stream rather than a crash.

Solutions

  1. Enable debug logging for the BarURLHandler/BarTransformer to see the suppressed exception cause.
  2. Validate the BAR's bar-deployment.xml and the OSGi manifest instructions it generates (imports/exports must be resolvable).
  3. Rebuild/repackage the BAR ensuring it is a valid zip containing bar-deployment.xml.
  4. If only process deployment is needed, use a plain bpmn: deployment or deploy through RepositoryService.createDeployment() instead of the bar: URL.

Example fix

// before: BAR without valid bar-deployment.xml
my-app.bar = [processes/*.bpmn20.xml]
// after: include a valid bar-deployment.xml with resolvable imports
<bar-deployment>
  <bundle symbolicName="my.app" version="1.0.0"/>
</bar-deployment>
Defensive patterns

Strategy: try-catch

Validate before calling

try (ZipFile bar = new ZipFile(barFile)) {
    if (bar.getEntry("bar-deployment.xml") == null)
        throw new IllegalArgumentException("BAR missing bar-deployment.xml");
}

Try / catch

try (InputStream in = barUrl.openStream()) {
    // consume generated bundle
} catch (IOException e) {
    logger.error("bar: bundle generation failed; check bar-deployment.xml", e);
}

Prevention

When it happens

Trigger: Opening a bar: URL (BarURLHandler.run) where BarTransformer.transform(barXmlURL, pout) throws: malformed or missing bar-deployment.xml inside the BAR, unresolvable bundle imports declared in it, or IO errors writing the generated jar.

Common situations: A BAR archive built with invalid OSGi manifest instructions; bar-deployment.xml referencing packages unavailable in the target container; corrupted BAR file deployed through the bpmn/bar URL stream handler.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-osgi/src/main/java/org/flowable/osgi/BarURLHandler.java:82

        public Connection(URL url) {
            super(url);
        }

        @Override
        public void connect() throws IOException {
        }

        @Override
        public InputStream getInputStream() throws IOException {
            final PipedInputStream pin = new PipedInputStream();
            final PipedOutputStream pout = new PipedOutputStream(pin);
            new Thread() {
                @Override
                public void run() {
                    try {
                        BarTransformer.transform(barXmlURL, pout);
                    } catch (Exception e) {
                        LOGGER.warn("Bundle cannot be generated");
                    } finally {
                        try {
                            pout.close();
                        } catch (IOException ignore) {
                            // if we get here something is very wrong
                            LOGGER.error("Bundle cannot be generated", ignore);
                        }
                    }
                }
            }.start();
            return pin;
        }
    }

}

View on GitHub (pinned to d6d39ce1c6)