[MAGNOLIA-4544] BootstrapUtil.bootstrap(String[], int) at root level lead sometimes into ItemExistsException Created: 21/Sep/12  Updated: 25/Nov/14  Resolved: 03/Sep/14

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.5
Fix Version/s: 4.5.22, 5.2.8, 5.3.3

Type: Bug Priority: Critical
Reporter: Milan Divilek Assignee: Roman Kovařík
Resolution: Fixed Votes: 5
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
relation
is related to MAGNOLIA-3973 bootstrap: can't overwrite top level ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: 4.5.13

 Description   

In BootstrapUtil.bootstrap(String[], int) method if the bootstraped node already exist then we delete this node and then we import new content. This sometime leads to ItemExistsException. Deletion and import should happen on same session so this should not lead to ItemExistsException. So we need to verify if really deletion and import happens on same session.

Maybe there should be no need to explicitly delete the imported node since that can be controlled by the uuid strategy.



 Comments   
Comment by Jaroslav Simak [ 27/Sep/12 ]

This is happening because of JR issue, see: https://issues.apache.org/jira/browse/JCR-3239.

Comment by Stefan Baur [ 19/Aug/13 ]

Hi

I suggest you implement a workaround for this enerving bug.
Can you put a hm.save() after the hm.delete(fullPath) in info.magnolia.importexport.BootstrapUtil#bootstrap() ?

Thanks
Stefan

Comment by Jaroslav Simak [ 29/Nov/13 ]

Hi Stefan,

putting hm.save() would completely broke rollback mechanism in update tasks. We can't do such workaround at the moment.

Regards,
Jaroslav

Comment by Nils Breunese [ 29/Nov/13 ]

Currently BootstrapUtil.bootstrap uses ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW because this is the default behavior set by the BootstrapResourcesTask(String name, String description) constructor which is called by the SamplesBootstrapTask() constructor.

Instead of deleting the imported node if it exists, before importing it with ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, it might be better if BootstrapUtil.bootstrap would not try to delete existing nodes itself, but just call DataTransporter.importXmlStream with ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING?

Comment by Matteo Pelucco [ 13/Dec/13 ]

ImportUUIDBehavior.IMPORT_UUID_COLLISION was used even in previous Magnolia versions without issues.
Does something changed in JackRabbit import behaviours?

Comment by Matteo Pelucco [ 13/Dec/13 ]

Maybe this can help: https://issues.apache.org/jira/browse/JCR-3279

Comment by Matteo Pelucco [ 13/Dec/13 ]

Quite curious: how did Magnolia solved this in VersionHandler from 5.0 --> 5.1 --> 5.1?

Comment by Jan Haderka [ 19/Dec/13 ]

@matteo it's not fixed. You don't always run into the issue, only if local item cache is not updated quickly enough.

Comment by Matteo Pelucco [ 19/Dec/13 ]

I see. Very critical issue..

Comment by Nils Breunese [ 04/Mar/14 ]

To me it doesn't make sense to first delete a node and then import it using ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW when there is another import behavior that seems a logical fit for this use case: ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING. Can anyone explain why that behavior isn't used in this case?

Comment by Jan Haderka [ 10/Mar/14 ]

Imagine following scenario:
in repository you have node website:/foo/bar/baz with uuid=1234
you want to bootstrap file website.fit.baz.xml with uuid=1234, hence the path will be translated to website:/fit/baz

Using REPLACE_EXISTING you end up with having
website:/foo/bar/baz with uuid=1234

Using REMOVE_EXISTING you end up with having
website:/fit/baz with uuid=1234

In both cases the former website:/foo/bar/baz and all its children are gone. Which is most likely not what you want.

What Magnolia does is attempt to remove the path website:/fit/baz only, should it already exist and bootstrap new content at exactly same path. And throw an error in case there is a collision because same UUID already exists elsewhere (which it should not). Unfortunately the bug in JR makes this strategy fail when item cache can't be refreshed fast enough.

Comment by Jan Haderka [ 23/May/14 ]

JR team claims this issue is not reproducible w/ JR 2.8 ... Can anyone who gets it regularly confirm?

Thx.

Comment by Nils Breunese [ 05/Jun/14 ]

We'll have to see if we can find some time to try this on Jackrabbit 2.8.

Comment by Jan Haderka [ 06/Jun/14 ]

@Nils if it makes it easier for trying, latest snapshot of Magnolia 5.3 is already using JR 2.8.

Comment by Nils Breunese [ 06/Jun/14 ]

We're still on Magnolia 4.5.19. Should Jackrabbit 2.8 work with that?

Comment by Jan Haderka [ 06/Jun/14 ]

Yes it should.

Comment by Rico Jansen [ 10/Jul/14 ]

I tested it with Jackrabbit 2.8.0 issue still exists:

2014-07-10 14:05:13,985 ERROR info.magnolia.module.InstallContextImpl           : > Error while installing or updating site-vpronl module. Task 'Bootstrap samples' failed. (ItemExistsException: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!)
java.lang.RuntimeException: Error importing file: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
	at info.magnolia.importexport.DataTransporter.importXmlStream(DataTransporter.java:369)
	at info.magnolia.importexport.BootstrapUtil.bootstrap(BootstrapUtil.java:113)
	at info.magnolia.module.delta.BootstrapResourcesTask.execute(BootstrapResourcesTask.java:67)
	at info.magnolia.module.delta.ConditionalDelegateTask.execute(ConditionalDelegateTask.java:64)
	at info.magnolia.module.ModuleManagerImpl.applyDeltas(ModuleManagerImpl.java:499)
	at info.magnolia.module.ModuleManagerImpl.installOrUpdateModule(ModuleManagerImpl.java:481)
	at info.magnolia.module.ModuleManagerImpl$1.doExec(ModuleManagerImpl.java:270)
	at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:443)
	at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:440)
	at info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:403)
	at info.magnolia.module.ModuleManagerImpl.performInstallOrUpdate(ModuleManagerImpl.java:264)
	at info.magnolia.module.ui.ModuleManagerNullUI.onStartup(ModuleManagerNullUI.java:69)
	at info.magnolia.cms.beans.config.ConfigLoader.load(ConfigLoader.java:151)
	at info.magnolia.init.MagnoliaServletContextListener$1.doExec(MagnoliaServletContextListener.java:249)
	at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:443)
	at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:440)
	at info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:403)
	at info.magnolia.init.MagnoliaServletContextListener.startServer(MagnoliaServletContextListener.java:246)
	at info.magnolia.init.MagnoliaServletContextListener.contextInitialized(MagnoliaServletContextListener.java:172)
	at info.magnolia.init.MagnoliaServletContextListener.contextInitialized(MagnoliaServletContextListener.java:126)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1740)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
	at sun.rmi.transport.Transport$1.run(Transport.java:177)
	at sun.rmi.transport.Transport$1.run(Transport.java:174)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: org.xml.sax.SAXException: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
javax.jcr.ItemExistsException: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
	at org.apache.jackrabbit.core.xml.SysViewImportHandler.processNode(SysViewImportHandler.java:104)
	at org.apache.jackrabbit.core.xml.SysViewImportHandler.startElement(SysViewImportHandler.java:134)
	at org.apache.jackrabbit.core.xml.ImportHandler.startElement(ImportHandler.java:175)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.ImportXmlRootFilter.startElement(ImportXmlRootFilter.java:161)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.SkipNodeFilter.startElement(SkipNodeFilter.java:89)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.RemoveMixversionableFilter.startElement(RemoveMixversionableFilter.java:87)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.VersionFilter.startElement(VersionFilter.java:125)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.MagnoliaV2Filter.startElement(MagnoliaV2Filter.java:160)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at info.magnolia.importexport.DataTransporter.importXmlStream(DataTransporter.java:329)
	... 62 more
Caused by: javax.jcr.ItemExistsException: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
	at org.apache.jackrabbit.core.xml.SessionImporter.resolveUUIDConflict(SessionImporter.java:230)
	at org.apache.jackrabbit.core.xml.SessionImporter.startNode(SessionImporter.java:408)
	at org.apache.jackrabbit.core.xml.SysViewImportHandler.processNode(SysViewImportHandler.java:93)
	... 88 more
2014-07-10 14:05:13,989 ERROR info.magnolia.cms.beans.config.ConfigLoader       : An unspecified error occurred during initialization: Error importing file: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
java.lang.RuntimeException: Error importing file: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
	at info.magnolia.importexport.DataTransporter.importXmlStream(DataTransporter.java:369)
	at info.magnolia.importexport.BootstrapUtil.bootstrap(BootstrapUtil.java:113)
	at info.magnolia.module.delta.BootstrapResourcesTask.execute(BootstrapResourcesTask.java:67)
	at info.magnolia.module.delta.ConditionalDelegateTask.execute(ConditionalDelegateTask.java:64)
	at info.magnolia.module.ModuleManagerImpl.applyDeltas(ModuleManagerImpl.java:499)
	at info.magnolia.module.ModuleManagerImpl.installOrUpdateModule(ModuleManagerImpl.java:481)
	at info.magnolia.module.ModuleManagerImpl$1.doExec(ModuleManagerImpl.java:270)
	at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:443)
	at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:440)
	at info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:403)
	at info.magnolia.module.ModuleManagerImpl.performInstallOrUpdate(ModuleManagerImpl.java:264)
	at info.magnolia.module.ui.ModuleManagerNullUI.onStartup(ModuleManagerNullUI.java:69)
	at info.magnolia.cms.beans.config.ConfigLoader.load(ConfigLoader.java:151)
	at info.magnolia.init.MagnoliaServletContextListener$1.doExec(MagnoliaServletContextListener.java:249)
	at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:443)
	at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:440)
	at info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:403)
	at info.magnolia.init.MagnoliaServletContextListener.startServer(MagnoliaServletContextListener.java:246)
	at info.magnolia.init.MagnoliaServletContextListener.contextInitialized(MagnoliaServletContextListener.java:172)
	at info.magnolia.init.MagnoliaServletContextListener.contextInitialized(MagnoliaServletContextListener.java:126)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1740)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
	at sun.rmi.transport.Transport$1.run(Transport.java:177)
	at sun.rmi.transport.Transport$1.run(Transport.java:174)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: org.xml.sax.SAXException: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
javax.jcr.ItemExistsException: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
	at org.apache.jackrabbit.core.xml.SysViewImportHandler.processNode(SysViewImportHandler.java:104)
	at org.apache.jackrabbit.core.xml.SysViewImportHandler.startElement(SysViewImportHandler.java:134)
	at org.apache.jackrabbit.core.xml.ImportHandler.startElement(ImportHandler.java:175)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.ImportXmlRootFilter.startElement(ImportXmlRootFilter.java:161)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.SkipNodeFilter.startElement(SkipNodeFilter.java:89)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.RemoveMixversionableFilter.startElement(RemoveMixversionableFilter.java:87)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.VersionFilter.startElement(VersionFilter.java:125)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at info.magnolia.importexport.filters.MagnoliaV2Filter.startElement(MagnoliaV2Filter.java:160)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at info.magnolia.importexport.DataTransporter.importXmlStream(DataTransporter.java:329)
	... 62 more
Caused by: javax.jcr.ItemExistsException: a node with uuid 5ba2c9be-6117-4d20-9d41-ed2a4f0ad884 already exists!
	at org.apache.jackrabbit.core.xml.SessionImporter.resolveUUIDConflict(SessionImporter.java:230)
	at org.apache.jackrabbit.core.xml.SessionImporter.startNode(SessionImporter.java:408)
	at org.apache.jackrabbit.core.xml.SysViewImportHandler.processNode(SysViewImportHandler.java:93)
	... 88 more
Comment by Jan Haderka [ 15/Jul/14 ]

Thanks for testing it.

When you tested, what was your exact setup? I'm trying to figure out configuration in which I would be able to reproduce it consistently.

Comment by Stefan Baur [ 15/Jul/14 ]

Hi Jan. For me it was enough to export a DMS item on a second level and import it on every update. Name of my export xml file: dms.flowplayer.xml
Just register a BootstrapResourcesTask that imports your xml file on every update or on startup.

Comment by Thomas Koerner [X] (Inactive) [ 31/Jul/14 ]

Hi,

the referenced JIRA issue stated, that this occurs only on top level items. I used the following workaround:

  • create workaround top level node
  • move "item to replace" below the workaround top level node
  • delete the "item to replace" which is now a second level node
  • bootstrap your new nodes
  • delete the workaround node on top level.

Hope that helps.

Comment by Joerg von Frantzius [ 04/Aug/14 ]

Hi,

any chances that Thomas Koerner's workaround is going to be applied in BootstrapUtil? I haven't tried it out, but it sounds reasonable (ugly as it is

Comment by Daniel Lipp [ 07/Aug/14 ]

we'll of course check it out - better an ugly workaround than an annoying bug...

Comment by Eric Hechinger [ 22/Aug/14 ]

@Nils
As it is really hard to reproduce this issue into our environment, would you kindly try the following patch on your environment (for M4.5.16 and higher)

Comment by Eric Hechinger [ 22/Aug/14 ]

M4.5.16 patch

Comment by Roman Kovařík [ 02/Sep/14 ]

Reopen: I was able to reproduce the issue with/wo the patch.

Comment by Roman Kovařík [ 03/Sep/14 ]

This is how I reproduced the issue:

 public class SomeModule implements ModuleLifecycle {
 @Override
    public void start(ModuleLifecycleContext ctx) {
        try {
            BootstrapUtil.bootstrap(new String[] { "/mgnl-bootstrap/someModule/website.second.xml" }, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
            MgnlContext.getJCRSession(RepositoryConstants.WEBSITE).save();

For QA:

  1. Import at root level.
  2. Import at first level (should fail without the patch);
  3. Import at a lower level (check that node has correct order after reimporting).
  4. Also try different workspaces.
Comment by Ravish Bhagdev [ 24/Nov/14 ]

Hi. I think this issue has not yet been fixed in 5.3.3!

I am getting the following:

15:33:14.703 [localhost-startStop-1] ERROR info.magnolia.module.InstallContextImpl - > Error while installing or updating dam-app module. Task 'Bootstrap' failed. (ItemExistsException: a node with uuid b971a2ef-175b-4e75-b66f-9260b293f6ae already exists!)
 java.lang.RuntimeException: Error importing config.modules.dam-app.apps.assets: a node with uuid b971a2ef-175b-4e75-b66f-9260b293f6ae already exists!

When trying to load my magnolia project today.

I have had this error before and usually redeploying and restarting worked. But I have had no joy at all with it today and am blocked.

I was actually on 5.3.2 but when I got this problem, and read this ticket, I upgraded to 5.3.3 and it still happens. I think the patch that is attached for DataTransporter has not been applied in 5.3.3!

I also notice that in the DAM module, there are files in mgnl-boostrap subfolders for assets that have duplicate UUIDs as well. I am not sure why this is but it has been working so far and just stopped working today without any changes.

Can someone please take a look and see if the patch should have been applied in 5.3.3?

I will appreciate any feedback on this issue as soon as possible.

Comment by Roman Kovařík [ 25/Nov/14 ]

Hello,

  • The attached patch is one of the tested versions of the fix which wasn't working. I removed it from attachments to prevent confusion.
  • This fix prevent from IEE when bootstrapping a node with under the same path. If there are more nodes with the same UUIDs but different path, IEE is thrown on purpose. It's possible that you are hitting a bug in the dam module.
  • I double checked that the fix was applied on 5.3.x branch.

Best regards.
Roman

Generated at Mon Feb 12 03:56:48 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.