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

Error when importing a document containing a class definition and objects of that class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.3 RC1
    • 1.3 M2
    • Storage
    • None

    Description

      This is because the saveXWikiCollection method calls getxWikiClass which in turn tries to load the same document which haven't been saved yet...

      The error we get is:

      com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while reading document Blog.Categories
      Wrapped Exception: a different object with the same identifier value was already associated with the session: [com.xpn.xwiki.doc.XWikiDocument#2090668008]
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:596)
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:158)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1101)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1143)
              at com.xpn.xwiki.XWiki.getClass(XWiki.java:5359)
              at com.xpn.xwiki.objects.BaseCollection.getxWikiClass(BaseCollection.java:126)
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:734)
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:434)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:97)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:91)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1077)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1050)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1044)
              at com.xpn.xwiki.plugin.packaging.Package.installDocument(Package.java:591)
              at com.xpn.xwiki.plugin.packaging.Package.install(Package.java:520)
              at com.xpn.xwiki.tool.backup.Importer.importDocuments(Importer.java:77)
              at com.xpn.xwiki.tool.backup.ImportMojo.execute(ImportMojo.java:64)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:549)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:544)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
              at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
              at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
              at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody4(MavenEmbedder.java:880)
              at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody5$advice(MavenEmbedder.java:304)
              at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
              at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
              at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
              at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
      
      
      Wrapped Exception:
      
      org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.xpn.xwiki.doc.XWikiDocument#2090668008]
              at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:150)
              at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
              at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
              at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
              at org.hibernate.impl.SessionImpl.load(SessionImpl.java:784)
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:491)
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:158)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1101)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1143)
              at com.xpn.xwiki.XWiki.getClass(XWiki.java:5359)
              at com.xpn.xwiki.objects.BaseCollection.getxWikiClass(BaseCollection.java:126)
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:734)
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:434)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:97)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:91)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1077)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1050)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1044)
              at com.xpn.xwiki.plugin.packaging.Package.installDocument(Package.java:591)
              at com.xpn.xwiki.plugin.packaging.Package.install(Package.java:520)
              at com.xpn.xwiki.tool.backup.Importer.importDocuments(Importer.java:77)
              at com.xpn.xwiki.tool.backup.ImportMojo.execute(ImportMojo.java:64)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:549)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:544)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
              at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
              at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
              at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody4(MavenEmbedder.java:880)
              at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody5$advice(MavenEmbedder.java:304)
              at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
              at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
              at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
              at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
      com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while reading document Blog.Categories
      Wrapped Exception: a different object with the same identifier value was already associated with the session: [com.xpn.xwiki.doc.XWikiDocument#2090668008]
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:596)
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:158)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1101)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1143)
              at com.xpn.xwiki.XWiki.getClass(XWiki.java:5359)
              at com.xpn.xwiki.objects.BaseCollection.getxWikiClass(BaseCollection.java:126)
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:734)
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:434)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:97)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:91)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1077)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1050)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1044)
              at com.xpn.xwiki.plugin.packaging.Package.installDocument(Package.java:591)
              at com.xpn.xwiki.plugin.packaging.Package.install(Package.java:520)
              at com.xpn.xwiki.tool.backup.Importer.importDocuments(Importer.java:77)
              at com.xpn.xwiki.tool.backup.ImportMojo.execute(ImportMojo.java:64)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:549)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:544)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
              at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
              at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
              at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody4(MavenEmbedder.java:880)
              at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody5$advice(MavenEmbedder.java:304)
              at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
              at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
              at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
              at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
      

      Note that we have 2 such documents in XE: Blog.Categories and XWiki.XWikiPreferences

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: