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

cancel
Showing results for 
Search instead for 
Did you mean: 
rohit9637
Established Member

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

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
afaust
Master

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

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
Professional

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

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
Senior Member

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

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

afaust
Master

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

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).

vincent-kali
Established Member

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

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