AnsweredAssumed Answered

Issue with adding an aspect with large multivalued list

Question asked by opensrcguy on Jun 22, 2011
Latest reply on Jun 23, 2011 by opensrcguy
Hi All,
    We are facing an issue when we add a lengthy values (say more than 200 values) for an aspect which is having multivalued property of type(d:text) while creating the wcm content.

Approach :


1.We are creating the content through java backed webscripts.
2.In the webscript, we are adding the aspect for the web content.
3.The aspect has multivalued properties.
4.We added some 200 values (type List<String>) to the multivalued property of the aspect.
5.Then we are adding the aspect to the content.
6.We are not getting any exception while adding the aspect, but when this webscript operation is committed as a transaction in the backend, we are getting the following error stacktrace.

When we try debugging the alfresco source, we found that if it exceeds some limit , the value is not saved as null. And when it tries access the null value, it is throwing an nullpointer exception.

So is there a limit for an multivalued property in Alfresco ?

Error Stack trace :

15:37:20,212  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: null
java.lang.NullPointerException
        at org.alfresco.repo.domain.PropertyValue$ValueType.convert(PropertyValue.java:512)
        at org.alfresco.repo.domain.PropertyValue.getValue(PropertyValue.java:1060)
        at org.alfresco.repo.avm.AVMNodeService.makeSerializableValue(AVMNodeService.java:207)
        at org.alfresco.repo.avm.AVMNodeService.getProperties(AVMNodeService.java:1120)
        at sun.reflect.GeneratedMethodAccessor320.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:215)
        at $Proxy10.getProperties(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor320.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:307)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:173)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:173)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:212)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:212)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy9.getProperties(Unknown Source)
        at org.alfresco.repo.node.integrity.IncompleteNodeTagger.processNode(IncompleteNodeTagger.java:401)
        at org.alfresco.repo.node.integrity.IncompleteNodeTagger.access$100(IncompleteNodeTagger.java:60)
        at org.alfresco.repo.node.integrity.IncompleteNodeTagger$1.doWork(IncompleteNodeTagger.java:385)
        at org.alfresco.repo.node.integrity.IncompleteNodeTagger$1.doWork(IncompleteNodeTagger.java:377)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
        at org.alfresco.repo.node.integrity.IncompleteNodeTagger.beforeCommit(IncompleteNodeTagger.java:391)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:738)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:718)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:674)
        at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:394)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:343)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:417)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:434)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:298)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:319)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:177)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Unknown Source)


     Aspect defined in content Model :

           
 
   <aspect name="custom:Aspect">
        <title>Custom Aspect</title>
        <properties>
             <property name="custom:applications">
                  <type>d:text</type>
                  <multiple>true</multiple>
                  <index enabled="true"/>
             </property>                                      
        </properties>
   </aspect>

    Webscript code where we add aspect to the web content :

               

private void attachAspect( AssetInfo assetInfo, ContentVO contentVO ){
      Map<QName, Serializable> aspectValues = new HashMap<QName, Serializable>();
      List<String> applications = new ArrayList<String>();

      for( int i = 1; i < 200; i++ ){
           applications.add("Adding "+i);                       
       }

      aspectValues.put( PROP_QNAME_APPLICATIONS, (Serializable) applications );

      try{
        /* this.services = ServiceRegistry instance */
        this.services.getAssetService().addAspect( assetInfo, CUSTOM_ASPECT, aspectValues );
       }
       catch( Exception e ){
            e.printStackTrace();
       }
   }

    If anyone has some information regarding this to share , please post it here.

Outcomes