dbeaver/dbeaver · error · DBException

Error instantiating geometry viewer

Error message

Error instantiating geometry viewer

What it means

Thrown by GeometryViewerDescriptor.createGeometryViewer() when reflective instantiation of the configured IGeometryViewer class fails. The descriptor reads the class name from the org.jkiss.dbeaver.data.gis.geometryViewer extension point and calls getImplClass().getConstructor(IValueController.class).newInstance(valueController); any Throwable from that chain is wrapped.

Source

Thrown at plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/registry/GeometryViewerDescriptor.java:84

    }

    public String getLabel() {
        return label;
    }

    public String getDescription() {
        return description;
    }

    public DBPImage getIcon() {
        return icon;
    }

    public IGeometryViewer createGeometryViewer(IValueController valueController) throws DBException {
        try {
            return (IGeometryViewer) type.getImplClass().getConstructor(IValueController.class).newInstance(valueController);
        } catch (Throwable e) {
            throw new DBException("Error instantiating geometry viewer", e);
        }
    }

    public boolean supportsInlineView() {
        return supportsInline;
    }

    public boolean supportedBy(DBPDataSource dataSource) {
        if (!supportedDataSources.isEmpty()) {
            if (dataSource == null) {
                return false;
            }
            if (!supportedDataSources.contains(dataSource.getContainer().getDriver().getProviderId())) {
                return false;
            }
        }
        return true;
    }

View on GitHub (pinned to 1e5ee1042b)

Solutions

  1. Verify the class attribute in plugin.xml for the geometryViewer extension matches a real, exported, instantiable class.
  2. Ensure the contributing plugin declares all required bundles in MANIFEST.MF Require-Bundle so the class loads.
  3. Confirm the viewer class has a public constructor with signature (IValueController).
  4. Inspect the wrapped Throwable cause — InvocationTargetException.getTargetException() reveals the constructor's actual exception.

Example fix

// before: viewer class without the expected constructor causes NoSuchMethodException
public class MyViewer implements IGeometryViewer {
    public MyViewer() { ... }   // no IValueController arg
}

// after: provide the constructor the descriptor reflectively looks up
public class MyViewer implements IGeometryViewer {
    public MyViewer(IValueController valueController) { ... }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate the extension class is loadable with the expected constructor before use
try {
    Class<?> clazz = type.getImplClass();
    clazz.getConstructor(IValueController.class);   // fail early if missing
} catch (NoSuchMethodException | ClassNotFoundException e) {
    throw new DBException("Geometry viewer class misconfigured", e);
}

Try / catch

try {
    return (IGeometryViewer) type.getImplClass()
        .getConstructor(IValueController.class).newInstance(valueController);
} catch (Throwable e) {
    throw new DBException("Error instantiating geometry viewer", e);
}

Prevention

When it happens

Trigger: Reflection fails: the class attribute in plugin.xml points to a missing/unloaded class (ClassNotFoundException), the class lacks a public constructor taking IValueController (NoSuchMethodException), the constructor is inaccessible (IllegalAccessException), or the constructor itself threw during newInstance (InvocationTargetException / user code exception).

Common situations: A custom geometry viewer extension with a wrong class attribute; a viewer class whose required bundle/dependency is missing from Require-Bundle; a constructor that throws on a null or unexpected IValueController; version mismatch where the class moved or was renamed.

Related errors


AI-assisted analysis of dbeaver/dbeaver@1e5ee1042b (2026-08-13). Data as JSON: /api/errors/e89102494a1940e8. Report an issue: GitHub.