{"record":{"id":"e89102494a1940e8","repo":"dbeaver/dbeaver","slug":"error-instantiating-geometry-viewer","errorCode":null,"errorMessage":"Error instantiating geometry viewer","messagePattern":"Error instantiating geometry viewer","errorType":"exception","errorClass":"DBException","httpStatus":null,"severity":"error","filePath":"plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/registry/GeometryViewerDescriptor.java","lineNumber":84,"sourceCode":"    }\n\n    public String getLabel() {\n        return label;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public DBPImage getIcon() {\n        return icon;\n    }\n\n    public IGeometryViewer createGeometryViewer(IValueController valueController) throws DBException {\n        try {\n            return (IGeometryViewer) type.getImplClass().getConstructor(IValueController.class).newInstance(valueController);\n        } catch (Throwable e) {\n            throw new DBException(\"Error instantiating geometry viewer\", e);\n        }\n    }\n\n    public boolean supportsInlineView() {\n        return supportsInline;\n    }\n\n    public boolean supportedBy(DBPDataSource dataSource) {\n        if (!supportedDataSources.isEmpty()) {\n            if (dataSource == null) {\n                return false;\n            }\n            if (!supportedDataSources.contains(dataSource.getContainer().getDriver().getProviderId())) {\n                return false;\n            }\n        }\n        return true;\n    }","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/dbeaver/dbeaver/blob/1e5ee1042bc61661368942aece126f3e67049955/plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/registry/GeometryViewerDescriptor.java#L66-L102","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the class attribute in plugin.xml for the geometryViewer extension matches a real, exported, instantiable class.","Ensure the contributing plugin declares all required bundles in MANIFEST.MF Require-Bundle so the class loads.","Confirm the viewer class has a public constructor with signature (IValueController).","Inspect the wrapped Throwable cause — InvocationTargetException.getTargetException() reveals the constructor's actual exception."],"exampleFix":"// before: viewer class without the expected constructor causes NoSuchMethodException\npublic class MyViewer implements IGeometryViewer {\n    public MyViewer() { ... }   // no IValueController arg\n}\n\n// after: provide the constructor the descriptor reflectively looks up\npublic class MyViewer implements IGeometryViewer {\n    public MyViewer(IValueController valueController) { ... }\n}","handlingStrategy":"try-catch","validationCode":"// Validate the extension class is loadable with the expected constructor before use\ntry {\n    Class<?> clazz = type.getImplClass();\n    clazz.getConstructor(IValueController.class);   // fail early if missing\n} catch (NoSuchMethodException | ClassNotFoundException e) {\n    throw new DBException(\"Geometry viewer class misconfigured\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return (IGeometryViewer) type.getImplClass()\n        .getConstructor(IValueController.class).newInstance(valueController);\n} catch (Throwable e) {\n    throw new DBException(\"Error instantiating geometry viewer\", e);\n}","preventionTips":["Keep the class attribute in plugin.xml in sync with the real implementing class name.","Declare all required bundles in MANIFEST.MF Require-Bundle so the class loads at runtime.","Ensure viewer classes expose a public constructor taking IValueController."],"tags":["gis","extension-point","reflection","instantiation"],"backgroundTag":null,"analyzedSha":"1e5ee1042bc61661368942aece126f3e67049955","analyzedAt":"2026-08-13T23:31:13.467Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}