--- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Fri Oct 23 20:34:57 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Sat Oct 24 12:09:08 2020 +0200 @@ -101,11 +101,11 @@ * @return a set of data access objects */ private DataAccessObjects createDataAccessObjects(Connection connection) throws SQLException { - final var df = (DatabaseFacade) getServletContext().getAttribute(DatabaseFacade.SC_ATTR_NAME); - if (df.getSQLDialect() == DatabaseFacade.Dialect.Postgres) { + final var df = (DataSourceProvider) getServletContext().getAttribute(DataSourceProvider.Companion.getSC_ATTR_NAME()); + if (df.getDialect() == DatabaseDialect.Postgres) { return new PGDataAccessObjects(connection); } - throw new AssertionError("Non-exhaustive if-else - this is a bug."); + throw new UnsupportedOperationException("Non-exhaustive if-else - this is a bug."); } private ResponseType invokeMapping(Map.Entry<PathPattern, Method> mapping, HttpServletRequest req, HttpServletResponse resp, DataAccessObjects dao) throws IOException { @@ -434,7 +434,7 @@ } // obtain a connection and create the data access objects - final var db = (DatabaseFacade) req.getServletContext().getAttribute(DatabaseFacade.SC_ATTR_NAME); + final var db = (DataSourceProvider) req.getServletContext().getAttribute(DataSourceProvider.Companion.getSC_ATTR_NAME()); final var ds = db.getDataSource(); if (ds == null) { resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "JNDI DataSource lookup failed. See log for details.");