JetBrains/intellij-community · error · RuntimeException
Error loading BeanInfo for component {className}: {reason}
Error message
Error loading BeanInfo for component {className}: {reason} What it means
Thrown by CompiledClassPropertiesProvider when java.beans.Introspector.getBeanInfo(componentClass) raises any Throwable while introspecting a component class to discover its bindable properties. The forms tooling relies on Java Bean introspection to list readable/writable properties of Swing and custom components; if introspection itself fails (not merely returns no descriptors), it is rethrown as a RuntimeException naming the component class and the underlying reason.
Source
Thrown at java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/CompiledClassPropertiesProvider.java:49
if (Utils.validateJComponentClass(myLoader, className, false) != null) {
return null;
}
final Class<?> aClass;
try {
aClass = Class.forName(className, false, myLoader);
}
catch (final ClassNotFoundException exc) {
throw new RuntimeException(exc.toString()); // should never happen
}
final BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(aClass);
}
catch (Throwable e) {
throw new RuntimeException("Error loading BeanInfo for component " + className + ": " + e.getMessage(), e);
}
final HashMap<String, LwIntrospectedProperty> result = new HashMap<>();
final PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
for (final PropertyDescriptor descriptor : descriptors) {
final Method readMethod = descriptor.getReadMethod();
final Method writeMethod = descriptor.getWriteMethod();
final Class<?> propertyType = descriptor.getPropertyType();
if (writeMethod == null || readMethod == null || propertyType == null) {
continue;
}
final String name = descriptor.getName();
final LwIntrospectedProperty property = propertyFromClass(propertyType, name);
if (property != null) {
property.setDeclaringClassName(descriptor.getReadMethod().getDeclaringClass().getName());View on GitHub (pinned to be881553f2)
Solutions
- Check the wrapped exception (cause) after the reason text — it identifies whether the failure is in a custom BeanInfo, a static initializer, or introspection itself.
- Fix or remove the custom BeanInfo class for the component (a malformed <Class>BeanInfo class is the most common culprit).
- Simplify the component's getter/setter signatures so the Introspector can process them without invoking user code.
- If the class is not meant to be a designer component, stop referencing it in .form files.
Defensive patterns
Strategy: try-catch
Try / catch
try { provider.getIntrospectedProperties(className); } catch (RuntimeException e) { if (e.getMessage() != null && e.getMessage().startsWith("Error loading BeanInfo")) { /* inspect e.getCause(): custom BeanInfo or initializer failure */ skipComponent(className); } else throw e; } Prevention
- Keep custom BeanInfo classes simple and side-effect free.
- Avoid static initializers in designer components that can throw.
- Test custom components in a plain Introspector.getBeanInfo call before using them in forms.
When it happens
Trigger: Calling the properties provider on a component class whose BeanInfo cannot be produced: the class has getter/setter methods that throw during introspection, a custom BeanInfo class that fails to load or instantiate, or introspection hits a LinkageError/RuntimeException. Any Throwable from Introspector.getBeanInfo lands in this catch.
Common situations: Custom component with a buggy static initializer touched by introspection; a custom XBeanInfo class on the classpath that throws in its constructor; classpath pollution where a partially compiled component class is introspected; running the forms compiler in an environment (e.g. build server) with a different JDK whose Introspector behavior differs.
Related errors
- Class not found:
- Unsupported class version error:
- Attempt to compile nested form with no nested form loader sp
- No binding on root component of nested form
- Recursive form nesting is not allowed
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/936b22418101a3c2.
Report an issue: GitHub.