[GH-ISSUE #1875] WebUI throws NULL exception when trying to create connection even though test connection appears to be successful #541

Closed
opened 2026-03-07 20:50:59 +03:00 by kerem · 0 comments
Owner

Originally created by @aleksandaratanasov on GitHub (Aug 7, 2023).
Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/1875

Describe the bug
Receiving

java.lang.NullPointerException: Cannot invoke "java.lang.Throwable.getMessage()" because "cause" is null
	at io.cloudbeaver.DBWebException.makeMessage(DBWebException.java:156)
	at io.cloudbeaver.DBWebException.<init>(DBWebException.java:60)
	at io.cloudbeaver.service.core.impl.WebServiceCore.createConnection(WebServiceCore.java:419)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

when trying to create a connection (WebUI) in a Kubernetes-deployed Cloudbeaver. Connection test on the other hand is successful.

To Reproduce
I have followed this post. Due to an issue with FluxCD not generating configmaps (currently looking into it) I have adapted (see below) the setup for manual deployment just to see if the rest works. This is how I came across the above mentioned error message.

Steps to reproduce deployment (in my case on Canonical microk8s Kubernetes):

  1. Create directory where project files will be stored and cd into it
  2. Add kustomization.yaml with following content to ./:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

metadata:
  name: cloudbeaver-vm

namespace: gin

resources:
  - dbeaver/deployment.yaml
  - dbeaver/service.yaml

configMapGenerator:
#DBEAVER
  - name: dbeaver-product-configmap-vm
    files:
      - dbeaver/configs/product.conf
  - name: dbeaver-sources-user-configmap-vm
    files:
      - dbeaver/configs/user/data-sources.json
  - name: dbeaver-sources-global-configmap-vm
    files:
      - dbeaver/configs/global/data-sources.json
  - name: dbeaver-server-configmap-vm
    files:
      - dbeaver/configs/cloudbeaver.conf

secretGenerator:
#DBEAVER
- name: dbeaver-secret-vm
  literals:
    - CB_SERVER_NAME=CloudBeaver Test Server
    - CB_ADMIN_NAME=admin.dbeaver
    - CB_ADMIN_PASSWORD=Password123

  1. Create subdirectory ./dbeaver
  2. Add deployment.yaml with following content to it:
kind: Deployment
apiVersion: apps/v1
metadata:
  name: cloudbeaver-vm
  namespace: gin
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  selector:
    matchLabels:
      app: cloudbeaver-vm
  template:
    metadata:
      labels:
        app: cloudbeaver-vm
    spec:
      containers:
        - name: cloudbeaver-vm
          image: dbeaver/cloudbeaver:latest
          imagePullPolicy: Always
          resources:
            requests:
              cpu: 200m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 256Mi
          ports:
            - name: web-access
              containerPort: 8978
          livenessProbe:
            httpGet:
              path: /
              port: 8978
              scheme: HTTP
            initialDelaySeconds: 300
            timeoutSeconds: 10
            periodSeconds: 300
            successThreshold: 1
            failureThreshold: 5
          envFrom:
          - secretRef:
              name: dbeaver-secret-vm
          volumeMounts:
            - name: dbeaver-product-vm
              mountPath: /opt/cloudbeaver/conf/product.conf
              subPath: product.conf
            - name: dbeaver-sources-user-vm
              mountPath: /opt/cloudbeaver/workspace/user-projects/admin.dbeaver/.dbeaver/data-sources.json
              subPath: data-sources.json
            - name: dbeaver-sources-global-vm
              mountPath: /opt/cloudbeaver/workspace/GlobalConfiguration/.dbeaver/data-sources.json
              subPath: data-sources.json
            - name: dbeaver-server-vm
              mountPath: /opt/cloudbeaver/conf/cloudbeaver.conf
              subPath: cloudbeaver.conf
      volumes:
        - name: dbeaver-product-vm
          configMap:
            name: dbeaver-product-configmap-vm
        - name: dbeaver-sources-user-vm
          configMap:
            name: dbeaver-sources-user-configmap-vm
        - name: dbeaver-sources-global-vm
          configMap:
            name: dbeaver-sources-global-configmap-vm
        - name: dbeaver-server-vm
          configMap:
            name: dbeaver-server-configmap-vm
  1. Add service.yaml with following content to it:
apiVersion: v1
kind: Service
metadata:
  name: cloudbeaver-vm
  namespace: gin
spec:
  type: NodePort
  externalIPs:
   - 192.168.122.109
  ports:
    - port: 8978
      targetPort: 8978
      nodePort: 32002
      protocol: TCP
  selector:
    app: cloudbeaver-vm

  1. Create subdirectory ./dbeaver/configs
  2. Add cloudbeaver.conf with following content to it:
{
    server: {
        serverPort: 8978,

        workspaceLocation: "workspace",
        contentRoot: "web",
        driversLocation: "drivers",

        rootURI: "/",
        serviceURI: "/api/",

        productConfiguration: "conf/product.conf",

        expireSessionAfterPeriod: 1800000,

        develMode: false,

        enableSecurityManager: false,

        database: {
            driver="h2_embedded",
            url: "jdbc:h2:${workspace}/.data/cb.h2.dat",

            createDatabase: true,

            initialDataConfiguration: "conf/initial-data.conf",

            pool: {
                minIdleConnections: 4,
                maxIdleConnections: 10,
                maxConnections: 100,
                validationQuery: "SELECT 1"
            }
        }

    },
    app: {
        anonymousAccessEnabled: false,
        anonymousUserRole: "user",
        supportsCustomConnections: false,

        forwardProxy: false,

        publicCredentialsSaveEnabled: false,
        adminCredentialsSaveEnabled: false,

        resourceManagerEnabled: true,

        resourceQuotas: {
            dataExportFileSizeLimit: 10000000,
            resourceManagerFileSizeLimit: 500000,
            sqlMaxRunningQueries: 100,
            sqlResultSetRowsLimit: 100000,
            sqlResultSetMemoryLimit: 2000000,
            sqlTextPreviewMaxLength: 4096,
            sqlBinaryPreviewMaxLength: 261120
        },
        enabledAuthProviders: [
            "local"
        ],

        disabledDrivers: [
            "sqlite:sqlite_jdbc",
            "h2:h2_embedded",
            "clickhouse:yandex_clickhouse"
        ]

    }

}
  1. Add product.conf with following content to it:
// Product configuration. Customized web application behavior
// It is in JSONC format
{
    // Global properties
    core: {
        // User defaults
        user: {
            defaultTheme: "dark",
            defaultLanguage: "en"
        },
        app: {
            // Log viewer config
            logViewer: {
                refreshTimeout: 3000,
                logBatchSize: 1000,
                maxLogRecords: 2000,
                maxFailedRequests: 3
            }
        },
        authentication: {
            anonymousAccessEnabled: false
        }
    },
    // Notifications config
    core_events: {
        notificationsPool: 5
    },
    plugin_data_spreadsheet_new: {
        hidden: false
    },
    plugin_data_export: {
        disabled: false
    }
}
  1. Create subdirectory ./dbeaver/configs/user
  2. Add data-sources,json with following content to it:
{
	"folders": {
		"My DBs": {}
	},
	"connections": {
		"gingis": {
			"provider": "postgresql",
			"driver": "postgres-jdbc",
			"name": "gingis",
			"description": "PostGIS connection to gingis DB",
			"save-password": false,
			"show-system-objects": true,
			"read-only": false,
			"folder": "My DBs",
			"configuration": {
				"user": "gin",
				"host": "192.168.122.123",
				"port": "5432",
				"database": "gingis",
				"url": "jdbc:postgresql://192.168.122.123:5432/gingis",
				"type": "test",
				"provider-properties": {
					"@dbeaver-show-non-default-db@": "true"
				},
				"auth-model": "native"
			}
		}
	},
	"connection-types": {
		"test": {
			"name": "Testing",
			"color": "128,0,0",
			"description": "Database for testing and learning",
			"auto-commit": true,
			"confirm-execute": false,
			"confirm-data-change": false,
			"auto-close-transactions": false
		}
	}
}
  1. Create subdirectory ./dbeaver/configs/global
  2. Add data-sources.json with following content to it:
{
	"folders": {},
	"connections": {}
}
  1. Run kubectl apply -k <project-dir> to apply changes to cluster node

Steps to reproduce the error in the WebUI:

  1. Search for database (for whatever reason the database was not being displayed so I tried Manual as well as Search). For some reason the DB, as defined in the user/data-sources.json is not loaded in the UI.
  2. Enter the required parameters (username gin, password gin1234, db name gingis, host 192.168.122.123). I tried also specifying the role (with and without)
  3. Press Create button

Screenshots
Result from connection test:
image

Result from connection creation:
image
image

Desktop (please complete the following information):

  • OS: Ubuntu Server 22.04 with latest stable microk8s Kubernetes flavour, window manager is IceWM

  • Browser Firefox

  • Version 115.0.2 (using snap)

    image

Additional context
One thing I saw in it is the fact that Cloudbeaver attempts to write to global/data-sources.json, which is in a read-only file system. Perhaps this is the reason for the problem? See log snippet in comment below.

Originally created by @aleksandaratanasov on GitHub (Aug 7, 2023). Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/1875 **Describe the bug** Receiving ``` java.lang.NullPointerException: Cannot invoke "java.lang.Throwable.getMessage()" because "cause" is null at io.cloudbeaver.DBWebException.makeMessage(DBWebException.java:156) at io.cloudbeaver.DBWebException.<init>(DBWebException.java:60) at io.cloudbeaver.service.core.impl.WebServiceCore.createConnection(WebServiceCore.java:419) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) ``` when trying to **create** a connection (WebUI) in a Kubernetes-deployed Cloudbeaver. Connection **test** on the other hand is successful. **To Reproduce** I have followed [this post](https://medium.com/@dionathan.chrys/setting-up-databases-access-with-cloudbeaver-on-kubernetes-7a811c04f24c). Due to an issue with FluxCD not generating configmaps (currently looking into it) I have adapted (see below) the setup for manual deployment just to see if the rest works. This is how I came across the above mentioned error message. #### Steps to reproduce deployment (in my case on Canonical `microk8s` Kubernetes): 1. Create directory where project files will be stored and `cd` into it 2. Add `kustomization.yaml` with following content to `./`: ``` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization metadata: name: cloudbeaver-vm namespace: gin resources: - dbeaver/deployment.yaml - dbeaver/service.yaml configMapGenerator: #DBEAVER - name: dbeaver-product-configmap-vm files: - dbeaver/configs/product.conf - name: dbeaver-sources-user-configmap-vm files: - dbeaver/configs/user/data-sources.json - name: dbeaver-sources-global-configmap-vm files: - dbeaver/configs/global/data-sources.json - name: dbeaver-server-configmap-vm files: - dbeaver/configs/cloudbeaver.conf secretGenerator: #DBEAVER - name: dbeaver-secret-vm literals: - CB_SERVER_NAME=CloudBeaver Test Server - CB_ADMIN_NAME=admin.dbeaver - CB_ADMIN_PASSWORD=Password123 ``` 3. Create subdirectory `./dbeaver` 4. Add `deployment.yaml` with following content to it: ``` kind: Deployment apiVersion: apps/v1 metadata: name: cloudbeaver-vm namespace: gin spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 1 strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 0 type: RollingUpdate selector: matchLabels: app: cloudbeaver-vm template: metadata: labels: app: cloudbeaver-vm spec: containers: - name: cloudbeaver-vm image: dbeaver/cloudbeaver:latest imagePullPolicy: Always resources: requests: cpu: 200m memory: 256Mi limits: cpu: 500m memory: 256Mi ports: - name: web-access containerPort: 8978 livenessProbe: httpGet: path: / port: 8978 scheme: HTTP initialDelaySeconds: 300 timeoutSeconds: 10 periodSeconds: 300 successThreshold: 1 failureThreshold: 5 envFrom: - secretRef: name: dbeaver-secret-vm volumeMounts: - name: dbeaver-product-vm mountPath: /opt/cloudbeaver/conf/product.conf subPath: product.conf - name: dbeaver-sources-user-vm mountPath: /opt/cloudbeaver/workspace/user-projects/admin.dbeaver/.dbeaver/data-sources.json subPath: data-sources.json - name: dbeaver-sources-global-vm mountPath: /opt/cloudbeaver/workspace/GlobalConfiguration/.dbeaver/data-sources.json subPath: data-sources.json - name: dbeaver-server-vm mountPath: /opt/cloudbeaver/conf/cloudbeaver.conf subPath: cloudbeaver.conf volumes: - name: dbeaver-product-vm configMap: name: dbeaver-product-configmap-vm - name: dbeaver-sources-user-vm configMap: name: dbeaver-sources-user-configmap-vm - name: dbeaver-sources-global-vm configMap: name: dbeaver-sources-global-configmap-vm - name: dbeaver-server-vm configMap: name: dbeaver-server-configmap-vm ``` 5. Add `service.yaml` with following content to it: ``` apiVersion: v1 kind: Service metadata: name: cloudbeaver-vm namespace: gin spec: type: NodePort externalIPs: - 192.168.122.109 ports: - port: 8978 targetPort: 8978 nodePort: 32002 protocol: TCP selector: app: cloudbeaver-vm ``` 6. Create subdirectory `./dbeaver/configs` 7. Add `cloudbeaver.conf` with following content to it: ``` { server: { serverPort: 8978, workspaceLocation: "workspace", contentRoot: "web", driversLocation: "drivers", rootURI: "/", serviceURI: "/api/", productConfiguration: "conf/product.conf", expireSessionAfterPeriod: 1800000, develMode: false, enableSecurityManager: false, database: { driver="h2_embedded", url: "jdbc:h2:${workspace}/.data/cb.h2.dat", createDatabase: true, initialDataConfiguration: "conf/initial-data.conf", pool: { minIdleConnections: 4, maxIdleConnections: 10, maxConnections: 100, validationQuery: "SELECT 1" } } }, app: { anonymousAccessEnabled: false, anonymousUserRole: "user", supportsCustomConnections: false, forwardProxy: false, publicCredentialsSaveEnabled: false, adminCredentialsSaveEnabled: false, resourceManagerEnabled: true, resourceQuotas: { dataExportFileSizeLimit: 10000000, resourceManagerFileSizeLimit: 500000, sqlMaxRunningQueries: 100, sqlResultSetRowsLimit: 100000, sqlResultSetMemoryLimit: 2000000, sqlTextPreviewMaxLength: 4096, sqlBinaryPreviewMaxLength: 261120 }, enabledAuthProviders: [ "local" ], disabledDrivers: [ "sqlite:sqlite_jdbc", "h2:h2_embedded", "clickhouse:yandex_clickhouse" ] } } ``` 8. Add `product.conf` with following content to it: ``` // Product configuration. Customized web application behavior // It is in JSONC format { // Global properties core: { // User defaults user: { defaultTheme: "dark", defaultLanguage: "en" }, app: { // Log viewer config logViewer: { refreshTimeout: 3000, logBatchSize: 1000, maxLogRecords: 2000, maxFailedRequests: 3 } }, authentication: { anonymousAccessEnabled: false } }, // Notifications config core_events: { notificationsPool: 5 }, plugin_data_spreadsheet_new: { hidden: false }, plugin_data_export: { disabled: false } } ``` 9. Create subdirectory `./dbeaver/configs/user` 10. Add `data-sources,json` with following content to it: ``` { "folders": { "My DBs": {} }, "connections": { "gingis": { "provider": "postgresql", "driver": "postgres-jdbc", "name": "gingis", "description": "PostGIS connection to gingis DB", "save-password": false, "show-system-objects": true, "read-only": false, "folder": "My DBs", "configuration": { "user": "gin", "host": "192.168.122.123", "port": "5432", "database": "gingis", "url": "jdbc:postgresql://192.168.122.123:5432/gingis", "type": "test", "provider-properties": { "@dbeaver-show-non-default-db@": "true" }, "auth-model": "native" } } }, "connection-types": { "test": { "name": "Testing", "color": "128,0,0", "description": "Database for testing and learning", "auto-commit": true, "confirm-execute": false, "confirm-data-change": false, "auto-close-transactions": false } } } ``` 11. Create subdirectory `./dbeaver/configs/global` 12. Add `data-sources.json` with following content to it: ``` { "folders": {}, "connections": {} } ``` 13. Run `kubectl apply -k <project-dir>` to apply changes to cluster node #### Steps to reproduce the error in the WebUI: 1. Search for database (for whatever reason the database was not being displayed so I tried **Manual** as well as **Search**). For some reason the DB, as defined in the `user/data-sources.json` is not loaded in the UI. 2. Enter the required parameters (username `gin`, password `gin1234`, db name `gingis`, host `192.168.122.123`). I tried also specifying the role (with and without) 3. Press **Create** button **Screenshots** Result from connection **test**: ![image](https://github.com/dbeaver/cloudbeaver/assets/3254568/c127a388-0814-4132-a049-c425dbb8f287) Result from connection **creation**: ![image](https://github.com/dbeaver/cloudbeaver/assets/3254568/9d0639db-e180-422d-9461-2ff8c709a90a) ![image](https://github.com/dbeaver/cloudbeaver/assets/3254568/2c4c4499-6664-421a-8557-91225316b9f8) **Desktop (please complete the following information):** - OS: Ubuntu Server 22.04 with latest stable microk8s Kubernetes flavour, window manager is **IceWM** - Browser Firefox - Version 115.0.2 (using `snap`) ![image](https://github.com/dbeaver/cloudbeaver/assets/3254568/c50504f0-9c18-4ffc-b0ff-55982481484b) **Additional context** One thing I saw in it is the fact that Cloudbeaver attempts to write to `global/data-sources.json`, which is in a read-only file system. Perhaps this is the reason for the problem? See log snippet in comment below.
kerem 2026-03-07 20:50:59 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cloudbeaver#541
No description provided.