I'm trying to deploy a custom action. I've developed the custom action as explained in the Wiki, extending ActionExecuterAbstractBase.But when I restart tomcat to load the new action I get this error:
16:46:40,723 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [es.binovo.alfresco.action.LegalXMLParser] for bean with name
'legal-xml-parser' defined in file [/var/lib/tomcat5.5/shared/classes/alfresco/extension/legal-xml-parser-context.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/alfresco/repo/action/executer/ActionExecuterAbstractBase
Caused by: java.lang.NoClassDefFoundError: org/alfresco/repo/action/executer/ActionExecuterAbstractBase
ActionExecuterAbstractBase does exist, in fact all the preconfigured actions reference this bean in the same way I'm doing, using the action-executer name. This bean seems already configured as the code "knows" that is needs the ActionExecuterAbstractBase so … Why isn't this working ?The class looks like this:package es.binovo.alfresco.action;
import java.util.List;
import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.apache.log4j.Logger;
/**
* @author iblanco
*
*/
public class LegalXMLParser extends ActionExecuterAbstractBase {
public final static String NAME = "legal-xml-parse";
/** The NodeService to be used by the bean */
protected NodeService nodeService;
/** The FileFolderService to be used by teh bean */
protected FileFolderService fileFolderService;
private static Logger logger = Logger.getLogger(LegalXMLParser.class);
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
// TODO Auto-generated method stub
if (logger.isDebugEnabled()) logger.debug("Inside executeImpl");
//Map<QName, Serializable> properties = nodeService.getProperties(actionedUponNodeRef);
ContentReader rawXML = fileFolderService.getReader(actionedUponNodeRef);
rawXML.setMimetype("text/xml");
String message = rawXML.getContentString();
logger.debug(message);
}
/* (non-Javadoc)
* @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List)
*/
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
// TODO Auto-generated method stub
logger.debug("Inside addParameterDefinitions");
}
/**
* @param nodeService The NodeService to set.
*
* Este método es el que proporciona un enganche para que con la configuración
* Spring que hagamos de esta acción de podamos pasar el servicio de nodos
* de Alfresco.
*
*/
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
public void setFileFolderService(FileFolderService fileFolderService){
this.fileFolderService = fileFolderService;
}
}I've compiled it and placed the class in a {tomcat_directory}/shared/classes/es/binovo/alfresco/action/LegalXMLParser.class.I also created legal-xml-parser-context.xml and placed it in {tomcat_directory}/shared/classes/alfresco/extension/, with content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!– Parse generated XML –>
<bean id="legal-xml-parser" class="es.binovo.alfresco.action.LegalXMLParser" parent="action-executer">
<property name="nodeService">
<ref bean="NodeService" />
</property>
<property name="fileFolderService">
<ref bean="FileFolderService" />
</property>
<property name="publicAction">
<value>true</value>
</property>
</bean>
</beans>