Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-16911

NPE when migrating subwikis on XWiki 11.10

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 11.10.1, 12.0-rc-1
    • 11.10
    • Old Core
    • Windows 10 Pro 64 bit, Chrome 78, using a local instance XWiki 11.10 on PostgreSQL 12
    • Integration
    • Unknown
    • N/A
    • N/A

    Description

      STEPS TO REPRODUCE

      1. Create an older instance of XWiki (e.g. 8.4.6)
      2. Create a subwiki
      3. Create an user on Main Wiki, as well on the subwiki (I added the user from Main Wiki to be a member of the subwiki)
      4. Close the instance
      5. Go to the newer instance (e.g. 11.10) and copy/cut the
        [...]webapps\xwiki

        folder and replace it (first delete the old one) in the same location on the older version

      1. Start XWiki and follow the Distribution Wizard through the upgrade process

      EXPECTED RESULTS

      The upgrade process for Main Wiki as well as for the subwiki is completed successfully without warnings/errors.

      ACTUAL RESULTS

      In console, there is the following stacktrace:

      2019-12-09 14:53:04,254 [XWiki initialization] ERROR .HibernateDataMigrationManager - Failed to migrate database [subwikiadmin]...
      com.xpn.xwiki.store.migration.DataMigrationException: Data migration R1138000XWIKI16709 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:667)
              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:658)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:619)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:796)
              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:363)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2106)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2168)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1399)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1366)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1271)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1208)
              at com.xpn.xwiki.XWiki.<init>(XWiki.java:1181)
              at com.xpn.xwiki.internal.XWikiInitializerJob.runInternal(XWikiInitializerJob.java:117)
              at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:240)
              at org.xwiki.job.AbstractJob.run(AbstractJob.java:217)
              at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.NullPointerException: null
              at com.xpn.xwiki.store.migration.hibernate.R1138000XWIKI16709DataMigration.applyMigrationsOnUser(R1138000XWIKI16709DataMigration.java:154)
              at com.xpn.xwiki.store.migration.hibernate.R1138000XWIKI16709DataMigration.hibernateMigrate(R1138000XWIKI16709DataMigration.java:115)
              at com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration.migrate(AbstractHibernateDataMigration.java:118)
              ... 24 common frames omitted
      2019-12-09 14:53:04,270 [XWiki initialization] ERROR .HibernateDataMigrationManager - 1 wiki database migration(s) failed.
      2019-12-09 14:53:04,282 [XWiki initialization] ERROR c.x.x.XWiki                    - Failed to initialize mandatory document
      com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while reading document [xwiki:XWiki.Notifications.Code.NotificationEmailRendererClass]
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:1000)
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:363)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2106)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2168)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1399)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1366)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1271)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1208)
              at com.xpn.xwiki.XWiki.<init>(XWiki.java:1181)
              at com.xpn.xwiki.internal.XWikiInitializerJob.runInternal(XWikiInitializerJob.java:117)
              at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:240)
              at org.xwiki.job.AbstractJob.run(AbstractJob.java:217)
              at java.lang.Thread.run(Unknown Source)
      Caused by: com.xpn.xwiki.XWikiException: Error number 3301 in 3: Exception while switching to database xwiki
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:664)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:619)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:796)
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:577)
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:870)
              ... 12 common frames omitted
      Caused by: com.xpn.xwiki.store.migration.DataMigrationException: 1 wiki database migration(s) failed.
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.startMigrations(AbstractDataMigrationManager.java:677)
              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:658)
              ... 16 common frames omitted
      2019-12-09 14:53:06,025 [XWiki Solr index thread] WARN  o.x.v.i.DefaultVelocityEngine  - Deprecated usage of getter [com.xpn.xwiki.api.Document.getName] in 52:xwiki:XWiki.XWikiUserSheet@1,114
      2019-12-09 14:53:06,205 [XWiki Solr index thread] WARN  o.x.v.i.DefaultVelocityEngine  - Deprecated usage of getter [com.xpn.xwiki.api.Document.getName] in 52:xwiki:XWiki.XWikiUserSheet@1,114
      2019-12-09 14:53:13,233 [XWiki Scheduler initialization] ERROR c.x.x.p.s.SchedulerPlugin      - Failed to restore existing scheduler jobs in wiki [subwikiadmin]
      com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching documents with SQL [select distinct doc.fullName from XWikiDocument as doc , BaseObject as obj where obj.name=doc.fullName and obj.className='XWiki.SchedulerJobClass']
              at com.xpn.xwiki.store.XWikiHibernateStore.searchGenericInternal(XWikiHibernateStore.java:2643)
              at com.xpn.xwiki.store.XWikiHibernateStore.searchDocumentReferencesInternal(XWikiHibernateStore.java:2588)
              at com.xpn.xwiki.store.XWikiHibernateStore.searchDocumentReferences(XWikiHibernateStore.java:2346)
              at com.xpn.xwiki.store.XWikiHibernateStore.searchDocumentReferences(XWikiHibernateStore.java:2318)
              at com.xpn.xwiki.store.XWikiCacheStore.searchDocumentReferences(XWikiCacheStore.java:425)
              at com.xpn.xwiki.plugin.scheduler.SchedulerPlugin.restoreExistingJobs(SchedulerPlugin.java:289)
              at com.xpn.xwiki.plugin.scheduler.SchedulerPlugin.initAsync(SchedulerPlugin.java:168)
              at com.xpn.xwiki.plugin.scheduler.SchedulerPlugin.access$000(SchedulerPlugin.java:80)
              at com.xpn.xwiki.plugin.scheduler.SchedulerPlugin$1.run(SchedulerPlugin.java:127)
              at org.xwiki.context.concurrent.ExecutionContextRunnable.run(ExecutionContextRunnable.java:70)
              at java.lang.Thread.run(Unknown Source)
      Caused by: com.xpn.xwiki.XWikiException: Error number 3301 in 3: Exception while switching to database subwikiadmin
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:664)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:619)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:796)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:741)
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:532)
              at com.xpn.xwiki.store.XWikiHibernateStore.searchGenericInternal(XWikiHibernateStore.java:2626)
              ... 10 common frames omitted
      Caused by: com.xpn.xwiki.store.migration.DataMigrationException: Migration of database [subwikiadmin] has failed, it could not be safely used! Database is currently in version [1130040] while the required version is [1138000].
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.preventAccessToOutdatedDb(AbstractDataMigrationManager.java:591)
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.checkDatabase(AbstractDataMigrationManager.java:542)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:658)
              ... 15 common frames omitted
      Caused by: com.xpn.xwiki.store.migration.DataMigrationException: Data migration R1138000XWIKI16709 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:667)
              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:658)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:619)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:796)
              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:363)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2106)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2168)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1399)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1366)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1271)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1208)
              at com.xpn.xwiki.XWiki.<init>(XWiki.java:1181)
              at com.xpn.xwiki.internal.XWikiInitializerJob.runInternal(XWikiInitializerJob.java:117)
              at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:240)
              at org.xwiki.job.AbstractJob.run(AbstractJob.java:217)
              ... 1 common frames omitted
      Caused by: java.lang.NullPointerException: null
              at com.xpn.xwiki.store.migration.hibernate.R1138000XWIKI16709DataMigration.applyMigrationsOnUser(R1138000XWIKI16709DataMigration.java:154)
              at com.xpn.xwiki.store.migration.hibernate.R1138000XWIKI16709DataMigration.hibernateMigrate(R1138000XWIKI16709DataMigration.java:115)
              at com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration.migrate(AbstractHibernateDataMigration.java:118)
              ... 24 common frames omitted
      2019-12-09 14:53:18,776 [org.xwiki.search.solr.internal.job.IndexerJob@476f9565([solr, indexer])] INFO  o.x.s.s.i.j.IndexerJob         - Starting job of type [solr.indexer] with identifier [[solr, indexer]]
      2019-12-09 14:53:18,988 [org.xwiki.search.solr.internal.job.IndexerJob@476f9565([solr, indexer])] ERROR o.x.s.s.i.j.IndexerJob         - Exception thrown during job execution
      java.lang.IllegalStateException: Failed to count the documents.
              at org.xwiki.search.solr.internal.job.DatabaseDocumentIterator.size(DatabaseDocumentIterator.java:161)
              at org.xwiki.search.solr.internal.job.DiffDocumentIterator.size(DiffDocumentIterator.java:152)
              at org.xwiki.search.solr.internal.job.IndexerJob.updateSolrIndex(IndexerJob.java:128)
              at org.xwiki.search.solr.internal.job.IndexerJob.runInternal(IndexerJob.java:110)
              at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:240)
              at org.xwiki.job.AbstractJob.run(AbstractJob.java:217)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
              at java.lang.Thread.run(Unknown Source)
      Caused by: org.xwiki.query.QueryException: Exception while executing query. Query statement = []
              at com.xpn.xwiki.store.hibernate.query.HqlQueryExecutor.execute(HqlQueryExecutor.java:182)
              at org.xwiki.query.internal.DefaultQueryExecutorManager.execute(DefaultQueryExecutorManager.java:72)
              at org.xwiki.query.internal.DefaultQuery.execute(DefaultQuery.java:306)
              at org.xwiki.search.solr.internal.job.DatabaseDocumentIterator.size(DatabaseDocumentIterator.java:158)
              ... 8 common frames omitted
      Caused by: com.xpn.xwiki.XWikiException: Error number 3301 in 3: Exception while switching to database subwikiadmin
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:664)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:619)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:796)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:741)
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:532)
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:819)
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.executeRead(XWikiHibernateBaseStore.java:889)
              at com.xpn.xwiki.store.hibernate.query.HqlQueryExecutor.execute(HqlQueryExecutor.java:170)
              ... 11 common frames omitted
      Caused by: com.xpn.xwiki.store.migration.DataMigrationException: Migration of database [subwikiadmin] has failed, it could not be safely used! Database is currently in version [1130040] while the required version is [1138000].
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.preventAccessToOutdatedDb(AbstractDataMigrationManager.java:591)
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.checkDatabase(AbstractDataMigrationManager.java:542)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:658)
              ... 18 common frames omitted
      Caused by: com.xpn.xwiki.store.migration.DataMigrationException: Data migration R1138000XWIKI16709 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:667)
              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:658)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:619)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:796)
              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:363)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2106)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2168)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1399)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1366)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1271)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1208)
              at com.xpn.xwiki.XWiki.<init>(XWiki.java:1181)
              at com.xpn.xwiki.internal.XWikiInitializerJob.runInternal(XWikiInitializerJob.java:117)
              at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:240)
              at org.xwiki.job.AbstractJob.run(AbstractJob.java:217)
              ... 1 common frames omitted
      Caused by: java.lang.NullPointerException: null
              at com.xpn.xwiki.store.migration.hibernate.R1138000XWIKI16709DataMigration.applyMigrationsOnUser(R1138000XWIKI16709DataMigration.java:154)
              at com.xpn.xwiki.store.migration.hibernate.R1138000XWIKI16709DataMigration.hibernateMigrate(R1138000XWIKI16709DataMigration.java:115)
              at com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration.migrate(AbstractHibernateDataMigration.java:118)
              ... 24 common frames omitted

      The issue could not be reproduced on XWiki 11.9

      Attachments

        Issue Links

          Activity

            People

              surli Simon Urli
              iandriuta Ilie Andriuta
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: