cancel
Showing results for 
Search instead for 
Did you mean: 

strange errors

michaelp
Confirmed Champ
Confirmed Champ
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?
4 REPLIES 4

s_palyukh
Star Contributor
Star Contributor
Hi,

Can you put here your stacktrace? Because your java code was compiled by me without any troubles.

The only useable error is

code>NoClassDefFoundError com.someco.azm.ActionHandIn$RunAsWork</code>

kaynezhang
World-Class Innovator
World-Class Innovator
Where did you place
com.someco.azm.ActionHandIn.class
file and
com.someco.azm.ActionHandIn$RunAsWork.class
file?
You should place them under classpath or extended classpath.

mrogers
Star Contributor
Star Contributor
And there's nothing wrong with your webscript definition.    However where is it deployed?