01-09-2018 08:00 AM
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>
<property name="policyComponent">
<ref bean="policyComponent" />
</property>
</bean>
i get an error:
GRAVE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextLoaderListener
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 {http://www.someco.com/model/ratings/1.0}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 rating.java file listed here...
alfresco-developer-series/Rating.java at master · jpotts/alfresco-developer-series · GitHub
01-09-2018 05:30 PM
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.
01-10-2018 03:37 AM
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?
Explore our Alfresco products with the links below. Use labels to filter content by product module.