cancel
Showing results for 
Search instead for 
Did you mean: 

Problem w/ cmd line export and space(letter) in folder name

mathias_lin
Star Contributor
Star Contributor
I get the following problem below when I try to export via command line tool and the folder name has a space in it's name (in my case: "Case Work"). Export works fine with a folder without a space (letter) in it's name though. How to handle folder name with a space in it so that xpath doesn't throw the error :?:

org.alfresco.tools.Export -user admin -pwd admin -store workspace://SpacesStore -path "/app:company_home/cm:Case Work" -verbose -overwrite -zip SpacesStore-content

The following error has occurred:
03160001 Error executing xpath:
   xpath: /app:company_home/cm:Case Work
org.alfresco.service.cmr.repository.XPathException: 03160001 Error executing xpath:
   xpath: /app:company_home/cm:Case Work
        at org.alfresco.repo.search.impl.NodeSearcher.selectNodes(NodeSearcher.java:178)
        at org.alfresco.repo.search.impl.lucene.ADMLuceneSearcherImpl.selectNodes(ADMLuceneSearcherImpl.java:698)
        at org.alfresco.repo.search.SearcherComponent.selectNodes(SearcherComponent.java:107)
        at org.alfresco.repo.search.AbstractSearcherComponent.selectNodes(AbstractSearcherComponent.java:66)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.
java:80)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMe
thodInterceptor.java:49)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy20.selectNodes(Unknown Source)
        at org.alfresco.repo.exporter.ExporterComponent$ExporterContextImpl.getNodeRef(ExporterComponent.java:1104)
        at org.alfresco.repo.exporter.ExporterComponent$ExporterContextImpl.<init>(ExporterComponent.java:985)
        at org.alfresco.repo.exporter.ExporterComponent$DefaultCrawler.export(ExporterComponent.java:271)
        at org.alfresco.repo.exporter.ExporterComponent.exportView(ExporterComponent.java:212)
        at org.alfresco.repo.exporter.ExporterComponent.exportView(ExporterComponent.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy77.exportView(Unknown Source)
        at org.alfresco.tools.Export.execute(Export.java:247)
        at org.alfresco.tools.Tool.start(Tool.java:216)
        at org.alfresco.tools.Export.main(Export.java:66)
Caused by: org.jaxen.XPathSyntaxException: Unexpected 'Work'
        at org.jaxen.BaseXPath.<init>(BaseXPath.java:132)
        at org.jaxen.BaseXPath.<init>(BaseXPath.java:153)
        at org.alfresco.repo.search.NodeServiceXPath.<init>(NodeServiceXPath.java:115)
        at org.alfresco.repo.search.impl.NodeSearcher.selectNodes(NodeSearcher.java:137)
        … 41 more
Caused by: class org.jaxen.saxpath.XPathSyntaxException: /app:company_home/cm:Case Work: 26: Unexpected 'Work'
        at org.jaxen.saxpath.base.XPathReader.createSyntaxException(XPathReader.java:1120)
        at org.jaxen.saxpath.base.XPathReader.parse(XPathReader.java:119)
        at org.jaxen.BaseXPath.<init>(BaseXPath.java:127)
        … 44 more

2010-04-16 13:09:14.140::INFO:  Shutdown hook executing
2010-04-16 13:09:14.250::INFO:  Shutdown hook complete

Furthermore, I wonder, how were the folders like "User Homes" or "Company Home" being created - I mean regarding the fact that their title and folder name is actually with a space "User Homes", while in the node browser they appear with lowercase and underscore, i.e. "user_homes". How can I create my folder in such a way that the primary path would also have a lowercase+underscore (case_work) instead of space.
(I cannot just set the folder name to that cause then the lowercase+underscore name would also be displayed in the Alfresco workplace, which I don't want the end user to see).
1 REPLY 1

mathias_lin
Star Contributor
Star Contributor
Found the solution. Space actually needs to be escaped with _x0020_, so it would be: "/app:company_home/cm:Case_x0020_Work"