quarkusio/quarkus · error · IllegalStateException

Failed to create an instance of " + CommonBean.class.getName

Error message

Failed to create an instance of " + CommonBean.class.getName() + " loaded from " + Thread.currentThread().getContextClassLoader()

What it means

Test-support guard in a gradle integration-test custom FileSystemProvider: reflectively instantiating CommonBean from the thread-context classloader failed (class not found/instantiable from that loader). This verifies classloading inside the custom provider; the input at fault is the TCCL-visible CommonBean class.

Source

Thrown at integration-tests/gradle/src/main/resources/custom-filesystem-provider/custom-filesystem-provider/src/main/java/org/acme/fs/AcmeFileSystemProvider.java:32

import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.FileAttributeView;
import java.nio.file.spi.FileSystemProvider;
import java.util.Map;
import java.util.Set;

import org.acme.common.CommonBean;

public class AcmeFileSystemProvider extends FileSystemProvider {

	final CommonBean bean;

	public AcmeFileSystemProvider() {
		try {
			bean = (CommonBean) Thread.currentThread().getContextClassLoader().loadClass(CommonBean.class.getName()).getDeclaredConstructor().newInstance();
		} catch (Exception e) {
			throw new IllegalStateException("Failed to create an instance of " + CommonBean.class.getName() + " loaded from " + Thread.currentThread().getContextClassLoader(), e);
		}
	}
	
	@Override
	public String getScheme() {
		return "acme";
	}

	@Override
	public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IOException {
		return null;
	}

	@Override
	public FileSystem getFileSystem(URI uri) {
		return null;
	}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure CommonBean and its dependencies are visible to the context classloader
  2. Check the declared constructor of CommonBean is accessible and throws no exception
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at integration-tests/gradle/src/main/resources/custom-filesystem-provider/custom-filesystem-provider/src/main/java/org/acme/fs/AcmeFileSystemProvider.java:32 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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