cancel
Showing results for 
Search instead for 
Did you mean: 

ActionExecuterAbstractBase not found

mangar
Star Contributor
Star Contributor
I havve done several actions in Explorer, but this is my first time in Share. I am trying a simple action to write hello world to the log file.  I have my action like this:

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.repository.NodeRef;

public class WriteToLogExecuter extends ActionExecuterAbstractBase {

    protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
    }

    public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) {
       System.out.println("Hello World!");
    }
   
}


in my custom-slingshot-application-context.xml I have the bean deff:
<bean id="write-to-log" class="com.sammy.share.action.executer.WriteToLogExecuter">
</bean>

when I start alfresco, I get Caused by: java.lang.ClassNotFoundException: org.alfresco.repo.action.executer.ActionExecuterAbstractBase

So It's finding MY class just fine, just not the BaseClass. 

Does this bean need to be in alfresco (ie. some-action-context.xml)   instead of share?
3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator
Hello,

how did you deploy your custom code? Did you put a JAR in /tomcat/lib/ or /tomcat/shared/lib/? Any class that depends on an interface / base class of Alfresco or another library needs to be put inside the same classpath in order for the dependent classes to be loaded. This means /tomcat/webapps/alfresco/WEB-INF/lib/. Only if you have an extension that is totally independent from Java code of an existing library, can you put it in another folder (e.g. JAR with JavaScript/FreeMarker-based web scripts, dashlets, templates etc.).

Regards
Axel

mangar
Star Contributor
Star Contributor
I placed my jar file in /tomcat/webapps/share/WEB-INF/lib

when I move my jar to /tomcat/webapps/alfresco/WEB-INF/lib, I get an error ClassNotFound in my custom-slingshot-application-context.xml as spring cannot find the class com.sammy.share.action.executer.WriteToLogExecuter.  Which makes sense as I moved it to the alfresco dir.

So I took a chance and copied all the jars from alfresco/WEB-INF/lib to share/WEB-INF/lib  and that ended in tears  Smiley Sad

So my question is how to resolve this chatch-22,  How do I use a spring bean in share, that uses alfresco classes?

afaust
Legendary Innovator
Legendary Innovator
Hello,

oh, I didn't catch your Spring configuration file name. Why are you referencing an action bean of a Repository tier action from the custom-slingshot-application-context.xml? Your last question in the original post is the correct assumption: You should use a Repository-tier Spring configuration file e.g. /tomcat/shared/classes/alfresco/extension/anyName-context.xml to load the action class, not a Share Spring configuration file. The JAR with your action still needs to go into the lib-folder of Alfresco Repository tier.

You can't simply include a bean in Share that uses Repository classes and perhaps tries to call services the Repository provides (i.e. the NodeService). These two need to be kept separate on the programming level. It is only by HTTP communication that Share and Repository components can work together. I.e. to provide the user an action in the Share UI, where the logic is coded in an action class of the Repositor tier, you connect the UI with the implementation via the Share Documentlibrary configuration. Please see Jeff Potts article about custom actions for a guide. Part 2 should be relevant to your current predicament.

Regards
Axel