The database I am using is postgres 11.4 but somehow, the xwiki keeps insisting, that my database is outdated, even though the service of my former database is disabled and I even changed the port, to ensure the hybernate.cfg is pointing to the new database.
How is the wiki still finding the old database version. What am I missing?
It’s not saying that you database engine is outdated but that the XWiki database scheme version is. That would suggest you disabled database migration check in xwiki.cfg (for faster startup) and forgot to put it back to 1.
The main reason why I thought, the database is still pointing to the old cluster was this line:
com.xpn.xwiki.store.migration.DataMigrationException: Migration of database [xwiki] has failed, it could not be safely used! Database is currently in version [93000] while the required version is [1130000].
This means the migrations were not executed on that database. You should take a look at the startup log before that, it’s supposed to indicate the version of the database, if it’s executing the migrations, which ones, etc.
I cannot answer those questions without the startup log which explain what it does, which migrations are executed and why. So take a look at the application server log and get the part which is talking about migration right after the first HTTP access to XWiki.
Sorry for the late response. We had to put this project on hold for a while but resumed it now.
What I did so far was that I tried to use the demo package and exported it via the xwiki gui, then changed the hybernate to postgres and reimported this. That worked just fine, so we can exclude the jdbc driver and the login credentials as possible error cause.
After that, I dropped the xwiki database again and imported a dump of my old postgres 9.5 database into my postgres 11. Then I copied the old Data directory do a new location and changed the start.bat accordingly and got the following output log at my xwiki startup
What am I missing? Maybe I did something wrong when I upgraded the database to 11, so if you could share best practice here, this would maybe already solve this issue.
you forgot to delete your solr index before starting on the new version
there indeed seems to be an issue with one of the migration
2019-08-21 11:26:20,202 [XWiki initialization] ERROR .HibernateDataMigrationManager - Failed to migrate database [xwiki]...
com.xpn.xwiki.store.migration.DataMigrationException: Data migration R98000NotificationPreferenceScopeMigration failed
at com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration.migrate(AbstractHibernateDataMigration.java:120)
at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.startMigrations(AbstractDataMigrationManager.java:837)
at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.migrateDatabase(AbstractDataMigrationManager.java:736)
at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.startMigrations(AbstractDataMigrationManager.java:657)
at com.xpn.xwiki.store.migration.hibernate.HibernateDataMigrationManager.startMigrations(HibernateDataMigrationManager.java:361)
at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.startMigrationsOnlyOnce(AbstractDataMigrationManager.java:637)
at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.tryToProcceedToMigration(AbstractDataMigrationManager.java:614)
at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.checkDatabase(AbstractDataMigrationManager.java:539)
at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:657)
at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:618)
at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:795)
at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:577)
at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:870)
at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:365)
at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2105)
at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2167)
at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1398)
at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1365)
at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1270)
at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1207)
at com.xpn.xwiki.XWiki.<init>(XWiki.java:1180)
at com.xpn.xwiki.internal.XWikiInitializerJob.runInternal(XWikiInitializerJob.java:117)
at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:236)
at org.xwiki.job.AbstractJob.run(AbstractJob.java:213)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: null
at org.xwiki.notifications.filters.internal.migrators.ScopeNotificationFilterClassMigrator.generateNewXObject(ScopeNotificationFilterClassMigrator.java:169)
at org.xwiki.notifications.filters.internal.migrators.ScopeNotificationFilterClassMigrator.migrateDocument(ScopeNotificationFilterClassMigrator.java:152)
at org.xwiki.notifications.filters.internal.migrators.ScopeNotificationFilterClassMigrator.hibernateMigrate(ScopeNotificationFilterClassMigrator.java:125)
at com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration.migrate(AbstractHibernateDataMigration.java:118)
... 24 common frames omitted
but it could also be a consequence of the solr module not initializing properly so I would start that fixing that and re-test.
This looks like something similar to Loading...
Looking at the code it seems the migrator cannot handle cases where an object in the list of XWiki.Notifications.Code.NotificationPreferenceScopeClass (the objects to be migrated) is null.
This can happen if one of these objects got deleted.
I guess one could try to write a helper script to remove these null entries, but that needs to happen on the old version before the migration. For the current version this can only be fixes in the migration code itself and needs a new XWiki release, I guess.
I find it a bit tricky to locate the missing entries via SQL. Is there any chance you can still point the old instance of XWiki to that database? Writing some code inside an XWiki page to clean them up will be easier for me.
and I will try to talk to the release manager for 11.7 which scheduled for Monday (I think) to see if it can be included or has to wait for 11.8.
Alternatively you can try to download this file: ScopeNotificationFilterClassMigrator.class.txt (7.9 KB)
(which is actually a .class file, not text), and place it in a to-be created directory C:\Program Files (x86)\wiki_11_6\webapps\wiki\WEB-INF\classes\org\xwiki\notifications\filters\internal\migrators (and rename it back to ScopeNotificationFilterClassMigrator.class , and then try again. I locally compiled it with the simple fix included, and this should make the migration pass. (Delete the file after the migration has finished.)
I cannot understand what the cause for the failure is, but I guess I better refrain from merging this to the release branch for 11.7 unless the problem is understood.
Maybe you can try to fix the migration with the patched class file instead?
@tmortagne, @ClemensRobbenhaar
Thank you very much for your quick reaction on this case. Once Wiki 11.8 is released, I will try to upgrade with the new files again and report back accordingly.