quarkusio/quarkus · error · IllegalArgumentException

Expected : after attribute

Error message

Expected : after attribute

What it means

AcmeFileSystemProvider's constructor loads CommonBean by name through the thread context classloader and instantiates reflectively; any failure (class not found, no default constructor, reflective-invocation exception) is wrapped in IllegalStateException("Failed to create an instance of ..."). It indicates the TCCL cannot see or construct CommonBean — a classloading setup problem in this custom NIO FileSystemProvider test fixture.

Source

Thrown at core/builder/src/main/java/io/quarkus/builder/JsonReader.java:133

                case '"':
                    readMember(members);
                    break;
            }
        }

        throw new IllegalArgumentException("Json object ended without }");
    }

    /**
     * member
     * |----- ws string ws ':' element
     */
    private void readMember(Map<JsonString, JsonValue> members) {
        final JsonString attribute = readString();
        ignoreWhitespace();
        final int colon = nextChar();
        if (':' != colon) {
            throw new IllegalArgumentException("Expected : after attribute");
        }
        final JsonValue element = readElement();
        members.put(attribute, element);
    }

    /**
     * array
     * |---- '[' ws ']'
     * |---- '[' elements ']'
     * </p>
     * elements
     * |----- element
     * |----- element ',' elements
     */
    private JsonValue readArray() {
        position++;

        final List<JsonValue> elements = new ArrayList<>();

View on GitHub (pinned to e1c734241f)

Solutions

  1. Build/install the custom-filesystem-provider module (it must be compiled and on the classpath together with CommonBean).
  2. Verify the TCCL at provider construction time can load CommonBean (set context classloader explicitly if needed).
  3. Check META-INF/services/java.nio.file.spi.FileSystemProvider registration matches the provider class.
  4. Ensure CommonBean has a public no-arg constructor and its FQN was not changed by relocation/refactoring.

Example fix

// before
bean = (CommonBean) Thread.currentThread().getContextClassLoader()
    .loadClass(CommonBean.class.getName()).getDeclaredConstructor().newInstance();
// after
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
if (tccl == null) { tccl = AcmeFileSystemProvider.class.getClassLoader(); }
Class<?> clazz = Class.forName(CommonBean.class.getName(), true, tccl);
bean = (CommonBean) clazz.getDeclaredConstructor().newInstance();
Defensive patterns

Strategy: try-catch

Validate before calling

if (given().header("tenantId", tenant).get("/fruits/" + id).getStatusCode() == 404) {
    throw new SkipException("No fruit " + id + " for tenant " + tenant);
}

Try / catch

try {
    Fruit f = given().header("tenantId", tenant).get("/fruits/" + id).then()
        .statusCode(200).extract().as(Fruit.class);
} catch (AssertionError notFound) {
    // 404: handle missing entity for this tenant
}

Prevention

When it happens

Trigger: Constructing the provider when Thread.currentThread().getContextClassLoader() cannot load io.quarkus.gradle...CommonBean (or equivalent), or the class lacks an accessible no-arg constructor, or newInstance() throws.

Common situations: Provider SPI registered in META-INF/services but loaded with a classloader lacking CommonBean on the classpath; custom-filesystem-provider jar not built/installed before the gradle test; TCCL reset by another framework; shading renaming CommonBean.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/97300b9e75ba3fce. Report an issue: GitHub.