AnsweredAssumed Answered

Can't deploy content run though XML metadata extractor..

Question asked by jtorelli on Jul 30, 2010
Hi!

I'm currently trying to setup XPath metadata extraction for forms entered via the WCM.. I'm able to extract the proper data and apply properties/aspects to a custom model, and everything with the content seems fine, until I use the deploy function to try and deploy this content over to an ASR's alfresco target..  Content that is not modified/processed by the wcm-xml-metadata-extractor seem to still deploy with no problem.

Looking at the debug info, the "dst" is null for any content that's going though the extractor, where content that doesn't use the extractor usually has a dst value that appears to point UUID..

Here's the debug info from the metadata extractor
Found metadata extracter to process XML document:
   Selector: XPathContentWorkerSelector[ workers={/NewsItem/*=org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter@10c37a9}]
   Document: ContentAccessor[ contentUrl=store://2010/7/30/19/26/b8f0c7eb-d49b-4e16-b98d-d4d62ade2849.bin, mimetype=text/xml, size=907, encoding=UTF-8, locale=en_US]
19:26:42,672 DEBUG [org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter]
Extracted XML metadata:
   Reader:  ContentAccessor[ contentUrl=store://2010/7/30/19/26/b8f0c7eb-d49b-4e16-b98d-d4d62ade2849.bin, mimetype=text/xml, size=907, encoding=UTF-8, locale=en_US]
   Results: {locales=en_US}
19:26:42,672 DEBUG [org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter]
XML metadata extractor redirected:
   Reader:    ContentAccessor[ contentUrl=store://2010/7/30/19/26/b8f0c7eb-d49b-4e16-b98d-d4d62ade2849.bin, mimetype=text/xml, size=907, encoding=UTF-8, locale=en_US]
   Extracter: org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter@10c37a9
   Metadata: {{http://www.ourcompany.com/model/content/1.0}locales=en_US}

And the error when I try to deploy this content:
19:27:43,488 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] lock taken{org.alfresco.deployment.lock}127.0.0.1.50500.alfresco
19:27:43,489 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] Deployment Lock Held: version -1, srcPath WontDeploy–admin:/www/avm_webapps, adapterName default, hostName 127.0.0.1, port 50,500, target alfresco
19:27:43,595 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] snapshot local created WontDeploy–admin, 5
19:27:43,617 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] START: (5, WontDeploy–admin:/www/avm_webapps) -> alfresco
19:27:44,406 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] comparing src:[LD:706:WontDeploy:/www/avm_webapps/ROOT, 2] dst:null
19:27:44,408 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] CREATED: (5, WontDeploy–admin:/www/avm_webapps/ROOT) -> /ROOT
19:27:44,549 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] CREATED: (5, WontDeploy–admin:/www/avm_webapps/ROOT/wcmContent) -> /ROOT/wcmContent
19:27:45,042 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] CREATED: (5, WontDeploy–admin:/www/avm_webapps/ROOT/wcmContent/news) -> /ROOT/wcmContent/news
19:27:45,063 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] closing deployment workers
19:27:45,166 ERROR [org.alfresco.deployment.impl.server.DeploymentReceiverEngineImpl] error in getSendToken ticket:21b7ba02-1d24-4b36-9012-3de716ae3515 path:/ROOT/wcmContent/news/ContentWontDeploy.xml, guid:166cbec1-0ce8-479d-8e0b-924be59637d4
org.alfresco.service.cmr.repository.InvalidNodeRefException: Live Node exists: workspace://SpacesStore/UNKNOWN
        at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.newNode(HibernateNodeDaoServiceImpl.java:1127)
        at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.newNode(HibernateNodeDaoServiceImpl.java:1103)
        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:307)




Notice this line:
19:27:44,406 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] comparing src:[LD:706:WontDeploy:/www/avm_webapps/ROOT, 2] dst:null

On a working deployment, this usually looks something like:
21:24:58,061 DEBUG [org.alfresco.repo.deploy.DeploymentServiceImpl] comparing src:[LD:949:new3:/www/avm_webapps/ROOT, 3] dst:[ROOT:DIR:18a3bff6-c874-4a41-b055-09430e575c58]

Here's my wcm-xml-metadata-extracter-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<!–
   Sample configuration of a XmlMetadataExtracter in use within the WCM environment.
  
   This show how XML metadata extraction can be set up to extract metadata from different
   formats of XML.  It also shows how metadata can be extracted in WCM projects.
  
   Since: 2.1
   Author: Derek Hulley
–>
<beans>
  
   <!–
      In order to limit the number of extractors active for Web Content Management, a separate registry
      must be created for the extractors.
   –>
   <bean id="avmMetadataExtracterRegistry" class="org.alfresco.repo.content.metadata.MetadataExtracterRegistry" />
  
   <!–
      Configure the AVM services to broadcast the content update notifications.
   –>
   <bean id="avmNodeService" class="org.alfresco.repo.avm.AVMNodeService" init-method="init">
      <property name="dictionaryService">
         <ref bean="dictionaryService"/>
      </property>
      <property name="avmService">
         <ref bean="avmLockingAwareService"/>
      </property>
      <property name="policyComponent">
         <ref bean="policyComponent"/>
      </property>
      <property name="tenantService">
         <ref bean="tenantService"/>
      </property>
      <property name="invokePolicies">
         <value>true</value>
      </property>
   </bean>
  
   <bean id="avmMetadataExtracter" class="org.alfresco.repo.avm.AvmMetadataExtracter" init-method="init">
      <property name="policyComponent">
         <ref bean="policyComponent"/>
      </property>
      <property name="extracterAction">
         <bean class="org.alfresco.repo.action.executer.ContentMetadataExtracter" >
            <property name="dictionaryService">
               <ref bean="dictionaryService"/>
            </property>
            <property name="nodeService">
               <ref bean="avmNodeService" />
            </property>
            <property name="contentService">
               <ref bean="contentService" />
            </property>
            <property name="metadataExtracterRegistry">
               <ref bean="avmMetadataExtracterRegistry" />
            </property>
            <property name="carryAspectProperties">
               <value>true</value>
            </property>
         </bean>
      </property>
   </bean>
  
      <!–
      Configure an extractor that targets Alfresco Model XML files.
      Although this inherits from the base extracter bean, the use of the 'init' method
      means that it isn't automatically registered.
   –>
   <bean id="extracter.xml.sample.AlfrescoModelMetadataExtracter"
         class="org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter"
         parent="baseMetadataExtracter"
         init-method="init" >
      <property name="mappingProperties">
         <!–
            The properties can also be specified using a properties file on the classpath, e.g.:
            <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
               <property name="location">
                  <value>classpath:alfresco/extension/xml-metadata/AlfrescoModel-xpath-mappings.properties</value>
               </property>
            </bean>
         –>
         <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
            <property name="properties">
               <props>
                  <prop key="namespace.prefix.nc">http://www.ourcompany.com/model/content/1.0</prop>
                 <prop key="locales">nc:locales</prop>

               </props>
            </property>
         </bean>
      </property>
      <property name="xpathMappingProperties">
         <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
            <property name="properties">
               <props>
                  <prop key="namespace.prefix.ni">http://www.alfresco.org/alfresco/news-item</prop>
                      <prop key="locales">/NewsItem/localSection/Locale</prop>

               </props>
            </property>
         </bean>
      </property>
   </bean>

   <!–
      This selector examines the XML documents, executing the given XPath statements until a
      match is made.
   –>
   <bean
         id="extracter.xml.sample.selector.XPathSelector"
         class="org.alfresco.repo.content.selector.XPathContentWorkerSelector"
         init-method="init">
      <property name="workers">
         <map>
<entry key="/NewsItem">
               <ref bean="extracter.xml.sample.AlfrescoModelMetadataExtracter" />
            </entry>

         </map>
      </property>
   </bean>
  
   <!–
      This is the face of the XML metadata extraction.  If passes the XML document to each of
      the selectors, until one of them gives back a MetadataExtracter (via the selectors),
      which is then used as normal to extract the values.
      Note the use of the AVM-specific registry.
      The overwrite policy of the embedded extracters has no effect.  It is only this extractor's
      policy that is used.
   –>
   <bean
         id="extracter.xml.sample.XMLMetadataExtracter"
         class="org.alfresco.repo.content.metadata.xml.XmlMetadataExtracter"
         parent="baseMetadataExtracter">
      <property name="registry">
         <ref bean="avmMetadataExtracterRegistry" />
      </property>

      <property name="overwritePolicy">
         <value>EAGER</value>
      </property>
      <property name="selectors">
         <list>
            <ref bean="extracter.xml.sample.selector.XPathSelector" />
         </list>
      </property>
   </bean>
  
</beans>

I tried configuring to add extracted properties/aspects to both the standard content model, and a custom content model, both with the same results..

Any thoughts on what could cause this? Looks everything's fine til I try and deploy to the ASR (IE I can view the nodes in the node browser, see the custom aspect with the proper data populated, etc)…

Outcomes