Closed heidivanparys closed 2 years ago
Dear @heidivanparys ,
Could you please check if at this moment the user exist in the database? My first impresion is that something wrong happened in the commit of the user in the databse, so the user was null so the session was not set. https://github.com/ec-jrc/re3gistry/blob/79f806053066cfa1fb1636ce34b64912004ccb32/sources/Re3gistry2JavaAPI/src/main/java/eu/europa/ec/re3gistry2/javaapi/handler/RegInstallationStep3Handler.java#L59
Thank you
Dear @emanuelaepure10 , the administrator exists in the database at the tine of the error. I tried the installation several times, and every time I deleted the user and its role mapping from the database manually before trying again.
I added extra logging to follow the process, it says:
[DEBUG] 2021-11-10 00:19:01.482 [http-nio-8080-exec-170] [handler.RegInstallationHandler.createRegUser:602] - Creating new administrator user
[DEBUG] 2021-11-10 00:19:01.487 [http-nio-8080-exec-170] [handler.RegInstallationHandler.createRegUser:622] - Administrator user eu.europa.ec.re3gistry2.model.RegUser[ uuid=4ea865adface3494971c6deb5ab1deac ] created
[DEBUG] 2021-11-10 00:19:01.608 [http-nio-8080-exec-170] [handler.RegInstallationHandler.createRegUser:631] - Administrator user eu.europa.ec.re3gistry2.model.RegUser[ uuid=4ea865adface3494971c6deb5ab1deac ] persisted and committed
Note that I also added log lines writing the HTTP session number, which is different all the time, which seems a bit odd, as the user seems to be stored in the session. If a new session is created for every step (the question is why?), that would explain why no user can be found in the (new) session, as it was set on an older session.
[TRACE] 2021-11-10 00:18:42.341 [http-nio-8080-exec-173] [controller.Install.processRequest:64] - Session id: 88884FC5F0ECD8961C899BB7B3C47123
[DEBUG] 2021-11-10 00:18:42.342 [http-nio-8080-exec-173] [controller.Install.processRequest:74] - install step = 1
[...]
[TRACE] 2021-11-10 00:18:48.146 [http-nio-8080-exec-174] [controller.Install.processRequest:64] - Session id: 4C933354ED0B8B9D1022ECFA9360356C
[DEBUG] 2021-11-10 00:18:48.222 [http-nio-8080-exec-174] [controller.Install.processRequest:74] - install step = 2
[...]
[TRACE] 2021-11-10 00:19:01.467 [http-nio-8080-exec-170] [controller.Install.processRequest:64] - Session id: A2A11E01D46DBD7F3450BD9599F1AC39
[DEBUG] 2021-11-10 00:19:01.467 [http-nio-8080-exec-170] [controller.Install.processRequest:74] - install step = 3
[...]
[TRACE] 2021-11-10 00:19:04.394 [http-nio-8080-exec-164] [controller.Install.processRequest:64] - Session id: 37FC2D1C38C865EC42B307E8FF4FE1C3
[DEBUG] 2021-11-10 00:19:04.395 [http-nio-8080-exec-164] [controller.Install.processRequest:74] - install step = clean-installation
[...]
[TRACE] 2021-11-10 00:19:47.320 [http-nio-8080-exec-176] [controller.Install.processRequest:64] - Session id: A6D887CB56C1EA19534555744763D60B
[DEBUG] 2021-11-10 00:19:47.320 [http-nio-8080-exec-176] [controller.Install.processRequest:74] - install step = clean-installation-summary
[...]
[TRACE] 2021-11-10 00:19:58.782 [http-nio-8080-exec-173] [controller.Install.processRequest:64] - Session id: 0A70FB5F1D490AE8CCE36E1BB4A60FA6
[DEBUG] 2021-11-10 00:19:58.782 [http-nio-8080-exec-173] [controller.Install.processRequest:74] - install step = clean-installation-process
[...]
Dear @heidivanparys - something that might be useful for deploying the tool is the build shell script we created for OSGEO Live. Following the steps in the script works on Lubuntu 18.
Dear @heidivanparys - something that might be useful for deploying the tool is the build shell script we created for OSGEO Live. Following the steps in the script works on Lubuntu 18.
Dear @alexanderkotsev, thanks for the tip, but I'm afraid it won't help, as that script depends on PostgreSQL, and we want to use Oracle, in order to comply with our agency’s architectural principles [1]. The error we get now really seems to be completely unrelated to the database.
[1] This should be possible according to the documentation of both Re3gistry and EclipseLink. Changes needed for that were:
persistence.jdbc.datasource
(https://github.com/heidivanparys/re3gistry/commit/390e8831dce4e10ae60fe447860624e054118330)persistence.jdbc.driver
, persistence.jdbc.url
and persistence.jdbc.datasource
to the relevant values for our Oracle database.This part works fine so far. We've had one error because EclipseLink expected another data type, see below, but as we got the Oracle error in the log file, we could easily fix that, recreate the database schema and try again.
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number
Error Code: 1722
Call: SELECT uuid, active, editdate, insertdate, iso6391code, iso6392code, label, masterlanguage FROM reg_languagecode WHERE (active = ?)
bind => [true]
As I can see here https://github.com/ec-jrc/re3gistry/blob/79f806053066cfa1fb1636ce34b64912004ccb32/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/Install.java the session is passed as a parameter to all the steps.
But, it might be usuful to use this solution https://stackoverflow.com/questions/2138245/session-is-lost-and-created-as-new-in-every-servlet-request or better this https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/new-httpsession-on-every-request/m-p/214835 which sets the <%@page session="false"%> in all the pages of the install package https://github.com/ec-jrc/re3gistry/tree/79f806053066cfa1fb1636ce34b64912004ccb32/sources/Re3gistry2/src/main/webapp/jsp/install Please see as well: https://stackoverflow.com/questions/5515729/why-set-a-jsp-page-session-false-directive
I havent yet test this solution but might help you to get the user from the same session. Please let us know if this helps
Thanks for the investigation and the links, some answers in there helped me to pinpoint the actual problem.
Now, I managed to get to the page saying that the Re3gistry software has been properly installed. The log also shows the same session id all the time now.
The log still contains errors, but those apparently didn't affect the installation process. See #80.
@heidivanparys I will consider this closed and we will work on the #80 . Thank you for you effort
Trying to perform an installation from scratch (thus no migration) gives "no user found", see also screenshot and extract from log file below.
Information about the deployment:
Investigation so far:
The code sets an attribute with the newly created administrator user on the session:
https://github.com/ec-jrc/re3gistry/blob/79f806053066cfa1fb1636ce34b64912004ccb32/sources/Re3gistry2JavaAPI/src/main/java/eu/europa/ec/re3gistry2/javaapi/handler/RegInstallationStep3Handler.java#L62
but in the next step, no user is found on the session (because it is in fact another session?), resulting in an error:
https://github.com/ec-jrc/re3gistry/blob/79f806053066cfa1fb1636ce34b64912004ccb32/sources/Re3gistry2JavaAPI/src/main/java/eu/europa/ec/re3gistry2/javaapi/handler/RegInstallationStepCleanInstallationProcessHandler.java#L75-L79
Any help on how to solve this issue would be greatly appreciated.