Custom behavior tutorial problem

Showing results for 
Search instead for 
Did you mean: 
Active Member

Custom behavior tutorial problem

Hi to all,

I'm trying to get to work custom behavior tutorial from jeff pots

Implementing Custom Behaviors in Alfresco | ECMArchitect | Alfresco Developer Tutorials 

when i try to create the spring bean in service-context.xml with:

<bean id="ratingBehavior" class="com.someco.behavior.Rating" init-method="init">
<property name="nodeService">
<ref bean="NodeService" />
<property name="policyComponent">
<ref bean="policyComponent" />

i get an error:

GRAVE: Exception sending context initialized event to listener instance of class
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ratingBehavior' defined in class path resource [alfresco/module/makeit-mvn-tutorial-alfresco/context/service-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Class {}ratingobj has not been defined in the data dictionary

I'v deployed the content model correctly, if i remove the bean from service-context.xml alfresco start-up and the model work but without the custom behavior.

Any hints? I believe there is some errors in file listed here...

alfresco-developer-series/ at master · jpotts/alfresco-developer-series · GitHub 

2 Replies

Re: Custom behavior tutorial problem

I don't know why, but the tutorial module-context.xml is missing the import of the bootstrap-context.xml to actually load the model. This looks like an oversight when Jeff moved the bootstrap to a separate file in a commit in April last year. Simply add an import to the bootstrap context before the import to the service context file, and you should be fine. I am somewhat in doubt that the model works at all with the current lack of an import.

Active Member

Re: Custom behavior tutorial problem

Ok Thanks, now my module-context.xml looks like this and alfresco starts.

<import resource="classpath:alfresco/module/${project.artifactId}/context/bootstrap-context.xml" />
<import resource="classpath:alfresco/module/${project.artifactId}/context/service-context.xml" />
<import resource="classpath:alfresco/module/${project.artifactId}/context/webscript-context.xml" />

Since it's not possible to create a child-associations through cmis workbench, there's a way to do that with alfresco API?