Help with update

Hello everyone,

I hope you can help me with the upgrade of my xWiki.

I tried to upgrade from 9.x to a the latest 11.5 and got a message, that my database is outdated.

I get the following errors.
Error 500 Server Error.txt (117.5 KB)

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?

BR
Björn

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.

I put
xwiki.store.migration=1
and
xwiki.store.migration.databases=all

Did I miss something else?

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 am not sure where I can enforce the migration then. What did I miss? Where do I have to do this?

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

2019_08_21.output.log (427.8 KB)

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.

Thanks in advance.

So I see two issues:

  • 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.

Hi @tmortagne

thank you for not giving up on me. I tried to wipe the solr directory in the data folder but the wiki still doesn’t come up.

The initialisation process stoped not at ~18-20%

here is the latest output log: 2019_08_21.output.log (595.0 KB)

This looks like something similar to
https://jira.xwiki.org/browse/XWIKI-14749
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.

what would be my best strategy here in this case? Do I have to wait for a later release?

I have access to the raw database. Is there a way to clear these references directly there? Can you give me guidance, where I can locate them?

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.

On the other hand the code fix is really easy.
I handled it in the issue:

https://jira.xwiki.org/browse/XWIKI-16678

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.)

Uh, oh, I see the CI tests fail after my commit:

https://ci.xwiki.org/job/XWiki/job/xwiki-platform/job/master/2171/

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?

Caused by: org.apache.http.NoHttpResponseException: nexus.xwiki.org:80 failed to respond

Nothing to do with your change @ClemensRobbenhaar, Nexus was down during the build it seems. IMO your fix is right.

@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.

Thanks to @tmortagne - who was more brave in the face of a failing CI :wink: - the fix will be available in 11.7 already.

That’s great news. We will try the 11.7 stable then, as soon as it is available and report back to you.

@tmortagne, @ClemensRobbenhaar Thank you very much for your help!