OpenAPITools/openapi-generator · error · IllegalArgumentException

The [returnJBossResponse] requires [useJakartaEe] to be true

Error message

The [returnJBossResponse] requires [useJakartaEe] to be true, because org.jboss.resteasy.reactive.RestResponse was introduced in Quarkus 2.x

What it means

Thrown by JavaJAXRSSpecServerCodegen.processOpts (quarkus library branch) when returnJBossResponse=true but useJakartaEe is false. The flag generates signatures returning org.jboss.resteasy.reactive.RestResponse, a type that only exists in Quarkus 2.x+ releases built on the jakarta.* namespace. Without useJakartaEe=true the generator would produce code referencing a class unavailable on the javax-era classpath, so it aborts with an explanation instead.

Source

Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java:302

            supportingFiles.add(new SupportingFile("application.properties.mustache", "src/main/resources", "application.properties")
                    .doNotOverwrite());
            supportingFiles.add(new SupportingFile("Dockerfile.jvm.mustache", "src/main/docker", "Dockerfile.jvm")
                    .doNotOverwrite());
            supportingFiles.add(new SupportingFile("Dockerfile.native.mustache", "src/main/docker", "Dockerfile.native")
                    .doNotOverwrite());
            supportingFiles.add(new SupportingFile("dockerignore.mustache", "", ".dockerignore")
                    .doNotOverwrite());
            if(returnResponse && returnJbossResponse) {
              String msg = String.format(Locale.ROOT,
                  "You cannot combine [%s] and [%s] since they are mutually exclusive",
                  RETURN_RESPONSE, RETURN_JBOSS_RESPONSE);
              throw new IllegalArgumentException(msg);
            }
            if(returnJbossResponse && !useJakartaEe) {
              String msg = String.format(Locale.ROOT,
                  "The [%s] requires [%s] to be true, because org.jboss.resteasy.reactive.RestResponse was introduced in Quarkus 2.x",
                  RETURN_JBOSS_RESPONSE, USE_JAKARTA_EE);
              throw new IllegalArgumentException(msg);
            }
        } else if (OPEN_LIBERTY_LIBRARY.equals(library)) {
            supportingFiles.add(new SupportingFile("server.xml.mustache", "src/main/liberty/config", "server.xml")
                    .doNotOverwrite());
            supportingFiles.add(new SupportingFile("beans.xml.mustache", "src/main/webapp/META-INF", "beans.xml")
                    .doNotOverwrite());
            supportingFiles.add(new SupportingFile("MANIFEST.MF.mustache", "src/main/webapp/META-INF", "MANIFEST.MF")
                    .doNotOverwrite());
            supportingFiles.add(new SupportingFile("microprofile-config.properties.mustache", "src/main/webapp/META-INF", "microprofile-config.properties")
                    .doNotOverwrite());
            supportingFiles.add(new SupportingFile("ibm-web-ext.xml.mustache", "src/main/webapp/WEB-INF", "ibm-web-ext.xml")
                    .doNotOverwrite());
        } else if (HELIDON_LIBRARY.equals(library)) {
            additionalProperties.computeIfAbsent("helidonVersion", key -> "2.4.1");
            supportingFiles.add(new SupportingFile("logging.properties.mustache", "src/main/resources", "logging.properties")
                    .doNotOverwrite());
            supportingFiles.add(new SupportingFile("microprofile-config.properties.mustache", "src/main/resources/META-INF", "microprofile-config.properties")
                    .doNotOverwrite());

View on GitHub (pinned to fcec517be3)

Solutions

  1. Add useJakartaEe=true: --additional-properties returnJBossResponse=true,useJakartaEe=true
  2. If you cannot move to Jakarta yet, drop returnJBossResponse and use returnResponse=true instead
  3. Upgrade the Quarkus project itself to 2.x+/3.x, since the generated RestResponse imports require that runtime anyway
  4. Keep returnJBossResponse and useJakartaEe as one bundled option set in your config template

Example fix

# before
openapi-generator-cli generate -g jaxrs-jersey -i api.yaml --library quarkus \
  --additional-properties returnJBossResponse=true

# after
openapi-generator-cli generate -g jaxrs-jersey -i api.yaml --library quarkus \
  --additional-properties returnJBossResponse=true,useJakartaEe=true
Defensive patterns

Strategy: validation

Validate before calling

boolean returnJBoss = Boolean.parseBoolean(String.valueOf(opts.getOrDefault("returnJBossResponse", "false")));
boolean jakartaEe = Boolean.parseBoolean(String.valueOf(opts.getOrDefault("useJakartaEe", "false")));
if (returnJBoss && !jakartaEe) {
    throw new IllegalArgumentException("returnJBossResponse requires useJakartaEe=true (RestResponse needs Quarkus 2.x+ / jakarta)");
}

Try / catch

try {
    generator.generate();
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("useJakartaEe")) {
        opts.put("useJakartaEe", "true"); // RestResponse only exists on jakarta-era Quarkus
        generator.generate();
    } else throw e;
}

Prevention

When it happens

Trigger: Running -g jaxrs-jersey --library quarkus with --additional-properties returnJBossResponse=true while useJakartaEe is unset/false — typical when a Quarkus 1.x/early-2.x config adopts the new response flag. Also when a global preset sets returnJBossResponse but per-project configs never opted into Jakarta.

Common situations: Quarkus migrations to 3.x: RESTEasy Reactive becomes default and teams want RestResponse signatures, but the base config predates useJakartaEe and was never updated. Flag inherited from a shared parent config while the Jakarta toggle lives in a different file.

Related errors


AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22). Data as JSON: /api/errors/c0ae100a6dd23b97. Report an issue: GitHub.