cancel
Showing results for 
Search instead for 
Did you mean: 

Class {xxx}xxx has not been defined in the data dictionary

rohit9637
Star Contributor
Star Contributor

I have deployed the custom model by the dynamic approach. I am trying to develop a behavior which will get triggered on Add aspect.

public void init() {
this.onAddAspect = new JavaBehaviour(this, "onAddAspect", NotificationFrequency.TRANSACTION_COMMIT);
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"onAddAspect"),QName.createQName("http://www.xyz.com/model/recruitment/1.0", "jobPostingEdit"), this.onAddAspect);
}

The jobPostingEdit Aspect belongs to model deployed dynamically.

While compiling it gives this issue.

Caused by: java.lang.IllegalArgumentException: Class {http://www.xyz.com/model/recruitment/1.0}jobPostingEdit has not been defined in the data dictionary

The Aspect is active and applied to documents and configured correctly.

Can we add behavior policy on Types or Aspect created dynamic approach or by the model manager?

5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator

You cannot define a behaviour against a model elements deployed dynamically using the common patterns documented for behaviours. This is due to the initiatlisation order of the behaviour and the model. Dynamic models are typically loaded on startup but after Spring singleton beans have been initialised. Since your behaviour is a Spring singleton bean and you are using an init-method to bind your behaviour, this binding happens before dynamic models had a chance to load. You may have to switch from using an init-method to using a Spring application event listener, and bind your behaviour once Alfresco has completed startup (including dynamic model loading).

Also be aware that dynamic models are loaded within the context of the tenant, so if you have enabled multi-tenancy, you are likely not able to bind a behaviour at all, since behaviours implemented via Spring beans are always global, and can't reference model elements from tenant contexts...

jpotts
World-Class Innovator
World-Class Innovator

This seems like a good time to reiterate that devs really shouldn't be using the model manager to define content models.

<cynical_view>I think that feature is really just for demonstration purposes for decision makers. Once the deal is closed and the real work begins, it's time to switch to XML based content models deployed via an AMP.</cynical_view>

4535992
Star Collaborator
Star Collaborator

Hi Faust, which is it the bean of the  "dynamic model loading" on Alfresco 5/6 ?

afaust
Legendary Innovator
Legendary Innovator

The bean responsible for loading any Repository-stored model (including those via Model Manager) is "dictionaryRepositoryBootstrap", though I don't really see how that information would help anyone deal with the underlying issue(s).

Hi Axel,

Could you please tell us to which Spring event to listen to in order to be sure that Alfresco has finished its startup ? More specifically that Alfresco has finished to load XML model ?

Thanks,

Vincent