Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while initializing db after installation #1493

Open
miljanuscumlic opened this issue Jul 26, 2017 · 7 comments
Open

Exception while initializing db after installation #1493

miljanuscumlic opened this issue Jul 26, 2017 · 7 comments
Assignees
Labels
bug issue confirmed as bug in progress Issue is actively being worked upon installer
Milestone

Comments

@miljanuscumlic
Copy link

What is the problem

After installation procedure there is a report on caught exception while initializing db.

What did you expect

No exception to appear.

Describe how to reproduce or add a test

Install exist-db. Uninstall it. Install it again with the same data directory as in the former installation and with old data within it.

Context information

  • eXist-db version 3.3.0, or 3.2.0
  • Java version Java8u131, Java8u141
  • Operating system Windows XP
  • 32
  • custom changes in e.g. conf.xml: none

This is the report I got:

The system cannot find the file C:\Programs\Java\jdk1.8.0_141.
The system cannot find the file C:\Programs\exist-db.
A subdirectory or file C:\Programs\eXist-db\tools\jetty\tmp already exists.
"-Xms64m -Xmx768m -Djava.endorsed.dirs="C:\Programs\eXist-db"\lib\endorsed"
--- Starting embedded database instance ---
Caught an exception while initializing db: Wrong password for user [admin] 
org.xmldb.api.base.XMLDBException: Wrong password for user [admin] 
--- Initialization complete. Shutdown embedded database instance ---
	at org.exist.xmldb.DatabaseImpl.getUser(DatabaseImpl.java:290)
	at org.exist.xmldb.DatabaseImpl.getLocalCollection(DatabaseImpl.java:187)
	at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:165)
	at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:156)
	at org.xmldb.api.DatabaseManager.getCollection(Unknown Source)
	at org.exist.installer.Setup.initDb(Setup.java:77)
	at org.exist.installer.Setup.main(Setup.java:66)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.exist.start.Main.invokeMain(Main.java:140)
	at org.exist.start.Main.run(Main.java:453)
	at org.exist.start.Main.main(Main.java:64)
Caused by: org.exist.security.AuthenticationException: Wrong password for user [admin] 
	at org.exist.security.internal.RealmImpl.authenticate(RealmImpl.java:274)
	at org.exist.security.internal.SecurityManagerImpl.authenticate(SecurityManagerImpl.java:435)
	at org.exist.xmldb.DatabaseImpl.getUser(DatabaseImpl.java:288)
	... 13 more
[B@1e7a35corg.exist.security.AuthenticationException: Wrong password for user [admin] 
	at org.exist.security.internal.RealmImpl.authenticate(RealmImpl.java:274)
	at org.exist.security.internal.SecurityManagerImpl.authenticate(SecurityManagerImpl.java:435)
	at org.exist.xmldb.DatabaseImpl.getUser(DatabaseImpl.java:288)
	at org.exist.xmldb.DatabaseImpl.getLocalCollection(DatabaseImpl.java:187)
	at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:165)
	at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:156)
	at org.xmldb.api.DatabaseManager.getCollection(Unknown Source)
	at org.exist.installer.Setup.initDb(Setup.java:77)
	at org.exist.installer.Setup.main(Setup.java:66)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.exist.start.Main.invokeMain(Main.java:140)
	at org.exist.start.Main.run(Main.java:453)
	at org.exist.start.Main.main(Main.java:64)
Caused by: org.exist.security.AuthenticationException: Wrong password for user [admin] 
	at org.exist.security.internal.RealmImpl.authenticate(RealmImpl.java:274)
	at org.exist.security.internal.SecurityManagerImpl.authenticate(SecurityManagerImpl.java:435)
	at org.exist.xmldb.DatabaseImpl.getUser(DatabaseImpl.java:288)
	at org.exist.xmldb.DatabaseImpl.getLocalCollection(DatabaseImpl.java:187)
	at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:165)
	at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:156)
	at org.xmldb.api.DatabaseManager.getCollection(Unknown Source)
	at org.exist.installer.Setup.initDb(Setup.java:77)
	at org.exist.installer.Setup.main(Setup.java:66)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.exist.start.Main.invokeMain(Main.java:140)
	at org.exist.start.Main.run(Main.java:453)
	at org.exist.start.Main.main(Main.java:64)

The part from the report Caught an exception while initializing db: Wrong password for user [admin] is pretty unclear because it is shown no matter what password is entered during installation whether it is the same or not as in the former installation.

After installation is done, the database does not seem to be broken and I can login as admin without any problems.

When I choose some empty data directory in my second installation, the report I am getting is:

The system cannot find the file C:\Programs\Java\jdk1.8.0_141.
The system cannot find the file C:\Programs\exist-db.
A subdirectory or file d:\eXist-db\tools\jetty\tmp already exists.
"-Xms64m -Xmx768m -Djava.endorsed.dirs="d:\eXist-db"\lib\endorsed"
--- Starting embedded database instance ---
Setting admin user password...
--- Initialization complete. Shutdown embedded database instance ---

The only difference in these two installation procedures is the chosen data directory.
Btw, I do not know why I am getting these The system cannot find the file errors because both mentioned directories exist.

@miljanuscumlic
Copy link
Author

When I do the same installation procedure (with the old data directory) with the 3.4.0 release, the result is the same.

@adamretter
Copy link
Member

The issue here is that the installer has a bug with regards to setting the password.

The facility for setting the password, does not recognize the situation when you are installing into a directory with an existing data dir. When there is an existing data-dir, that database may have a different database password. The installer always expects the database to have an empty admin password, because that is what is there when you install into an empty directory.

The password screen in the installer needs to modified to recognize an existing data-dir and either prompt for the password of the existing database, before offering to let you set a new password, or probably just skip offering to set the password altogether (as the existing database already has a password set).

@adamretter adamretter added the bug issue confirmed as bug label Jul 27, 2017
@adamretter adamretter added this to the eXist-3.4.1 milestone Jul 27, 2017
@miljanuscumlic
Copy link
Author

It would be nice that installer can except all the data and the admin username and password from the old data directory. In that case upgrade procedure would be quite smoother if the new version is binary compatible. I presume this procedure of update is safe and that exist accepts all data this way.

@adamretter adamretter modified the milestones: eXist-3.5.0, eXist-3.4.1 Jul 27, 2017
@adamretter
Copy link
Member

adamretter commented Jul 27, 2017

So it looks like to be able to do more complex conditional processing in IzPack, we need to be using IzPack 5 first. I have done the majority of the work for that already here: #1489

Once we are on IzPack5, the User Input Panel for Memory and Admin Password, needs to be split into two separate panels, where the Password Panel is conditionally shown if an existing database is not present. For the conditions see:

  1. https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/491681/Panels#Panels-Examples
  2. https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/491635/Conditions
  3. https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/491718/Exists+Condition

@adamretter adamretter self-assigned this Sep 25, 2017
@adamretter adamretter modified the milestones: eXist-3.5.0, eXist-3.6.0 Sep 28, 2017
@miljanuscumlic
Copy link
Author

miljanuscumlic commented Oct 4, 2017

@adamretter I see that this bug-fix is planned for the eXist-3.6.0, but I can see improvements (thanks for your work) in eXist-3.5.0 and just want to inform you about what I am getting during update from eXist-3.4.0 to eXist-3.5.0.
After choosing existing data-dir and old admin username and password I am no longer getting the exception I have reported. But I am getting this report in the console:
D:\eXist-db\webapp\WEB-INF\data - isDir: true - mustExist: false - canCreate: false
So, exist did not except this existing data-dir and it used its default data directory instead: %EXIST_HOME%/webapp/WEB-INF/data.

@adamretter
Copy link
Member

@miljanuscumlic Okay thanks. Unfortunately the work with IzPack is stuck as the IzPack developers seem to be ignoring issues. I don't know how else to contact that, but here is the issue I raised with them: https://izpack.atlassian.net/browse/IZPACK-1582

@adamretter adamretter modified the milestones: eXist-3.6.0, eXist-3.7.0 Nov 27, 2017
@adamretter adamretter modified the milestones: eXist-3.7.0, eXist-4.1.0 Feb 14, 2018
@wolfgangmm wolfgangmm modified the milestones: eXist-4.1.0, eXist-5.0.0 Apr 16, 2018
@duncdrum duncdrum added the in progress Issue is actively being worked upon label Jan 11, 2019
@adamretter
Copy link
Member

Okay we have now mover to IzPack 5 for eXist-db 5, so we could again continue with this issue...

@adamretter adamretter modified the milestones: eXist-5.1.0, eXist-5.2.0 Nov 19, 2019
@adamretter adamretter modified the milestones: eXist-5.2.0, eXist-5.3.0 Jan 23, 2020
@line-o line-o modified the milestones: eXist-5.3.0, eXist-6.0.0 Jun 28, 2021
@line-o line-o added this to the eXist-5.3.1 milestone Jul 1, 2021
@adamretter adamretter modified the milestones: eXist-5.3.1, eXist-5.3.2 Dec 16, 2021
@adamretter adamretter modified the milestones: eXist-5.3.2, eXist-6.0.2 Feb 14, 2022
@adamretter adamretter modified the milestones: eXist-6.0.2, eXist-6.1.1 Jan 15, 2023
@adamretter adamretter modified the milestones: eXist-6.1.1, eXist-7.0.1 Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug in progress Issue is actively being worked upon installer
Projects
None yet
Development

No branches or pull requests

5 participants