#1 2024-03-06 02:00:17

adam_alsc
Member
Registered: 2024-03-06

Error in Internal DB Startup (NullPointerException)

I've been trying to test out RS4.6.2-6102 Enterprise.

I built a simple Docker image based on tomcat9-jre11

FROM tomcat:9-jre11

ENV JAVA_OPTS="-Xmx4096M -XX:MaxMetaspaceSize=512M"

ADD ["src", "$CATALINA_HOME/webapps/ROOT/"]
ADD ["init.sh", "init.sh"]

CMD ["./init.sh"]

`init.sh` just interpolates some env vars into `persistence.properties` and `reportserver.properties` and then calls `catalina.sh run`.

I build the image and run it locally using docker-compose:

version: "3.5"

services:

  rs:
    build: .
    ports:
      - "8080:8080"
    env_file:
      - ./.env

  db:
    image: mysql:8.0
    command: mysqld --sql_mode="ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION" --default-authentication-plugin=mysql_native_password
    ports:
      - "33306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: ....
      MYSQL_DATABASE: reportserver
      MYSQL_USER: reportserver
      MYSQL_PASSWORD: ....

I start the `db` container first, import the base schema, then start the `rs` container.
The application boots up and everything works as expected.

So I moved the deployment to my client's production environment, where their services run on Docker Engine Swarm of physical servers and databases are hosted by OVH Managed Database for MySQL (Aiven)

I created an empty database on the managed DB instance and imported the same base schema as for local tests.

I took that exact container image I used locally, pushed it to Amazon ECR, and deployed the docker-compose onto the Swarm.

Watching the container logs, database checks go fine:

### DB Config ###
hibernate.dialect: net.datenwerke.rs.utils.hibernate.MySQL5Dialect (OK)
hibernate.connection.driver_class: com.mysql.jdbc.Driver (OK)
hibernate.connection.url: jdbc:mysql://mysql-XXXXXX-XXXXXX.database.cloud.ovh.net:20184/reportserver (OK)
hibernate.connection.username: reportserver
hibernate.default_schema:

Connection Test: OK
Schema Version: RS3.0-26

### Internal datasource metadata ###
Database name: MySQL
Database version: 8.0.30
Driver name: MySQL Connector/J
Driver version: mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c)
JDBC major version: 4
JDBC minor version: 2
JDBC URL: jdbc:mysql://mysql-XXXXXX-XXXXXX.database.cloud.ovh.net:20184/reportserver
JDBC username: reportserver@192.168.0.12

but the initialization does not:

Application Server: Apache Tomcat/9.0.86

### PAM Configuration ###
Static PAM configuration: net.datenwerke.rs.authenticator.service.pam.UserPasswordPAMAuthoritative
Finalized PAM configuration: class net.datenwerke.rs.authenticator.service.pam.UserPasswordPAMAuthoritative


01:31:16.102 WARN  n.d.r.c.s.c.ConfigServiceImpl - Configfile datasources/internaldb.cf could not be loaded. Default values are in effect.
01:31:16.106 WARN  n.d.r.c.s.c.ConfigServiceImpl - Configfile datasources/internaldb.cf could not be loaded. Default values are in effect.
01:31:16.143 ERROR n.d.r.c.s.i.InternalDbStartup - Error in Internal DB Startup
java.lang.NullPointerException: null
    at net.datenwerke.rs.core.service.internaldb.TempTableServiceImpl.getConnectionConfig(TempTableServiceImpl.java:86)
    at net.datenwerke.rs.core.service.internaldb.TempTableServiceImpl.dropRSTMPtables(TempTableServiceImpl.java:65)
    at net.datenwerke.rs.core.service.internaldb.InternalDbStartup.lambda$0(InternalDbStartup.java:51)
    at net.datenwerke.gf.service.lateinit.LateInitStartup$1.run(LateInitStartup.java:62)
    at java.base/java.lang.Thread.run(Unknown Source)

Those last three lines are where the remote deployment behaviour departs from the local deployment.

I can open ReportServer in the browser...It shows an error popup ("Could not find config for datasources/databasebundle.cf") that I can dismiss, then log in using default credentials - it looks on the surface to be working, but everything is empty; for example, I open Administration -> Users and Groups and there are no defaults groups; I open Administration -> Filesystem and under "FileServer Root" there are no files.

I searched through the logs inside the container but I can't find anything more than "java.lang.NullPointerException: null" to point to what the issue is.

It seems to be pointing to some difference between the stock MySQL container used in local testing and the OVH Managed Database used in production?

Any pointers on what I could try next?

Last edited by adam_alsc (2024-03-06 02:05:20)

Offline

#2 2024-03-06 10:23:38

malte_if
Administrator
Registered: 2023-05-10
Website

Re: Error in Internal DB Startup (NullPointerException)

Hi adam_alsc,

make sure you configured the internal datasource correctly and defined it to be used as the internal database (datasources/internaldb.cf).

--> 4.1.3. Internal database

Kind regards
Malte

Offline

#3 2024-03-06 15:12:32

adam_alsc
Member
Registered: 2024-03-06

Re: Error in Internal DB Startup (NullPointerException)

That's where I'm having the difficulty.

I run the same container image in both places, supplying no external file configuration (only env vars), so theoretically the app should function identically in both places...but it doesn't

When I run locally against "stock" MySQL, ReportServer internally creates all those files in its database - I've searched the container, they don't get created anywhere on the filesystem but the app still works properly.

Why then, when run against a different form of MySQL (Aiven DBaaS) does it fail to create those internal files automatically?

The ReportServer documentation says its not required to set up these files
https://reportserver.net/en/guides/conf … ion-Files/

> ReportServer has only two (external) config files which hold information on the database connection as well as information on available authentication methods. All other configuration is done from within ReportServer.

and that's how it works when I run a container locally using the image.
...but I have no idea why that breaks with a NullPointerException against my production database server.

Offline

#4 2024-03-07 00:46:09

adam_alsc
Member
Registered: 2024-03-06

Re: Error in Internal DB Startup (NullPointerException)

I found an interim workaround: since the locally-running container was able to initialize the ReportServer database properly, I dumped that local database and imported into the production database. ReportServer now boots up properly in production and everything seems to be working fine.

Offline

#5 2024-03-07 07:36:05

malte_if
Administrator
Registered: 2023-05-10
Website

Re: Error in Internal DB Startup (NullPointerException)

Hi adam_alsc,

can you please share your reportserver.properties?

You need to have

rs.install.basedata = true

active.

Regards
Malte

Offline

Board footer

Powered by FluxBB