I have been trying to figure out why I cannot use the UPDATE_EXISTING import Strategy and I think I have tracked it down to a bug.When I try to execute an import using the UPDATE_EXISTING Import Strategy, I get the following exception.16:04:43,035 DEBUG [web.publish.PublishWebsiteRemote] Begin Execution of Import with Parms… {encoding=UTF-8, binding=U
PDATE_EXISTING, destination=workspace://SpacesStore/447abbd9-87d5-11dc-b0d3-b7b5a51138f9}
16:04:43,207 ERROR [[localhost].[/site].[Publish]] Servlet.service() for servlet Publish threw exception
org.alfresco.service.cmr.view.ImporterException: Failed to import package at line 35; column 16 due to error: Duplicate
child name not allowed: PrivacyPolicy
at org.alfresco.repo.importer.view.ViewParser.parse(ViewParser.java:190)
at org.alfresco.repo.importer.ImporterComponent.parserImport(ImporterComponent.java:360)
at org.alfresco.repo.importer.ImporterComponent.importView(ImporterComponent.java:235)
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:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodIntercep
tor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMe
thodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:238)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy52.importView(Unknown Source)
at org.alfresco.repo.action.executer.ImporterActionExecuter.executeImpl(ImporterActionExecuter.java:185)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:120)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:537)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:472)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:399)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:387)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:545)
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:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodIntercep
tor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMe
thodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:256)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:191)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy19.executeAction(Unknown Source)
at com.tlhc.wc.web.publish.PublishWebsiteRemote.testACPImport(PublishWebsiteRemote.java:165)
at com.tlhc.wc.servlet.PublishController.processRequest(PublishController.java:103)
at com.tlhc.wc.servlet.PublishController.access$000(PublishController.java:23)
at com.tlhc.wc.servlet.PublishController$ProcessDownloadContentWork.doWork(PublishController.java:86)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:260)
at com.tlhc.wc.servlet.PublishController.doPost(PublishController.java:47)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.alfresco.service.cmr.repository.DuplicateChildNodeNameException: Duplicate child name not allowed: Privac
yPolicy
at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.setChildNameUnique(HibernateNodeDaoServiceImp
l.java:698)
at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.transaction.TransactionalDaoInterceptor.invoke(TransactionalDaoInterceptor.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy1.setChildNameUnique(Unknown Source)
at org.alfresco.repo.node.db.DbNodeServiceImpl.setChildUniqueName(DbNodeServiceImpl.java:2022)
at org.alfresco.repo.node.db.DbNodeServiceImpl.createNode(DbNodeServiceImpl.java:353)
at sun.reflect.GeneratedMethodAccessor417.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.transaction.TransactionResourceInterceptor.invoke(TransactionResourceInterceptor.java:138)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy2.createNode(Unknown Source)
at sun.reflect.GeneratedMethodAccessor417.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxy
Factory.java:221)
at $Proxy3.createNode(Unknown Source)
at sun.reflect.GeneratedMethodAccessor417.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:211)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy2.createNode(Unknown Source)
at sun.reflect.GeneratedMethodAccessor417.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.
java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMe
thodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:238)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy2.createNode(Unknown Source)
at org.alfresco.repo.importer.ImporterComponent$NodeImporter$CreateNewNodeImporterStrategy.importNode(ImporterCo
mponent.java:1265)
at org.alfresco.repo.importer.ImporterComponent$NodeImporter.importNode(ImporterComponent.java:550)
at org.alfresco.repo.importer.view.ViewParser.importNode(ViewParser.java:847)
at org.alfresco.repo.importer.view.ViewParser.processEndType(ViewParser.java:811)
at org.alfresco.repo.importer.view.ViewParser.processEndElement(ViewParser.java:791)
at org.alfresco.repo.importer.view.ViewParser.parse(ViewParser.java:182)
… 68 moreI traced this down as follows:This is the ImporterComponent Class with the binding passed in. It then creates the proper nodeImporter and sends it to viewParse.parse public void parserImport(NodeRef nodeRef, QName childAssocType, Reader viewReader, ImportPackageHandler streamHandler, ImporterBinding binding, ImporterProgress progress)
{
ParameterCheck.mandatory("Node Reference", nodeRef);
ParameterCheck.mandatory("View Reader", viewReader);
ParameterCheck.mandatory("Stream Handler", streamHandler);
Importer nodeImporter = new NodeImporter(nodeRef, childAssocType, binding, streamHandler, progress);
try
{
nodeImporter.start();
viewParser.parse(viewReader, nodeImporter);
nodeImporter.end();
}
catch(RuntimeException e)
{
nodeImporter.error(e);
throw e;
}
}ViewParse.parse then sets the importer to the parserContext class which is then passed throughout the rest of the parsing public void parse(Reader viewReader, Importer importer)
…
ParserContext parserContext = new ParserContext();
parserContext.importer = importer;
parserContext.dictionaryService = dictionaryService;
parserContext.elementStack = new Stack<ElementContext>();
try
{
for (int eventType = xpp.getEventType(); eventType != XmlPullParser.END_DOCUMENT; eventType = xpp.next())
{
switch (eventType)
{
case XmlPullParser.START_TAG:
{
if (xpp.getDepth() == 1)
{
processRoot(xpp, parserContext);
}
else
{
processStartElement(xpp, parserContext);
}
break;
}
case XmlPullParser.END_TAG:
{
processEndElement(xpp, parserContext);
break;
}
}…You can then trace to processEndElement method, then to processEndType method then to importNode (note the stacktrace). /**
* Import node
*
* @param parserContext parser context
* @param node node context
*/
private void importNode(ParserContext parserContext, NodeContext node)
{
if (node.getNodeRef() == null)
{
// Import Node
NodeRef nodeRef = node.getImporter().importNode(node);
node.setNodeRef(nodeRef);
// Maintain running list of "import" scoped ids
String importId = node.getImportId();
if (importId != null && importId.length() > 0)
{
createImportReference(parserContext, importId, nodeRef);
}
}
}
Notice the code in importNode calls node.getImporter().importNode();
This then creates a different import strategy and tries to import the node. It seems to me it should call parserContext.getImporter.importNode(…)
The only question I have that may mean it's not where the bug is, is why the node is null in the first place. The node I am importing does exist so should it be a valid noderef by the time it hits importNode?