AnsweredAssumed Answered

strange errors

Question asked by michaelp on Aug 7, 2014
Latest reply on Aug 13, 2014 by kaynezhang
Hello,

I am out of my patience.

Can somebody explain this?

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ContentService' is defined



   <bean id="webscript.com.someco.azm.handin.get" class="com.someco.azm.ActionHandIn" parent="webscript">
   <property name="contentService">
            <ref bean="ContentService"/>
        </property>
        <property name="nodeService">
            <ref bean="NodeService"/>
        </property>
        <property name="personService">
            <ref bean="PersonService"/>
        </property>
   </bean>


And also the java class won't work.


package com.someco.azm;

import java.io.IOException;

import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PersonService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.AbstractWebScript;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;

public class ActionHandIn extends AbstractWebScript {
    private static Log logger = LogFactory.getLog(ActionHandIn.class);

    private ContentService contentService;
    private NodeService nodeService;
    private PersonService personService;

    public void setContentService(ContentService contentService) {
        this.contentService = contentService;
    }

    public void setNodeService(NodeService nodeService) {
        this.nodeService = nodeService;
    }

    public void setPersonService(PersonService personService) {
        this.personService = personService;
    }

   @Override
   public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException {
      
      if (logger.isInfoEnabled())
         logger.info("### INFO ###");
      
      if (logger.isDebugEnabled())
         logger.debug("### Debug ###");
      
      if (logger.isErrorEnabled())
         logger.error("### Error ###");
      
   }
   
   protected void moveContent(final NodeRef contentRef, final NodeRef targetRef) {

      AuthenticationUtil.runAs(new RunAsWork<String>() {

         @SuppressWarnings("synthetic-access")

         public String doWork() throws Exception {

            // move content to target folder

            nodeService.moveNode(contentRef, targetRef, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CHILDREN);

            if (logger.isDebugEnabled())
               logger.debug("Move set");

            return "";

         }

      },

      "admin");

   }

}



Gives error on compiling:

NoClassDefFoundError com.someco.azm.ActionHandIn$RunAsWork


What should I do?

Outcomes