Contributed by Andrzej Adamczyk
Symptoms
Using Database Mapping ( ) to map a class to an external database, you see errors on screen and in the PegaRULES log for the database table that you are mapping to.
In another scenario, you update the Active Directory database user and restart the Tomcat application server. You get an NPE when trying to start the system.
Errors
Errors on screen
Error encountered investigating table: null
Error encountered investigating table: Database-General
Errors in PegaRULES log
Caught exception looking up external database column names
java.lang.NullPointerException: null
24-Jan-2020 16:40:26.501 SEVERE [main] com.pega.pegarules.internal.bootstrap.PRBootstrap. Problem during method invocation (contextInitialized)
java.lang.ExceptionInInitializerError
Explanations
Running the query SELECT SCHEMA_NAME(); fails in the context of the database user running the Pega application.
No default schema was defined for the database user specified for the Pega application. A default schema must be defined at the database level for the system to start.
Environments
The problem was reported in the following environments:
- Pega Platform 8.3™
- Pega Platform™ 8.7.4 in Pega Cloud® services 2.24.4
Solution
Specify the default schema as dbo for the database user.
ALTER USER <role> WITH DEFAULT_SCHEMA = dbo;
Related content
How to map an external database table to a class
Viewing database class mappings