cancel
Showing results for 
Search instead for 
Did you mean: 

Problem acessing custom content model in dev environment

risenhoover
Champ in-the-making
Champ in-the-making
Hi All,

I am starting to write some Java classes that will run within the JVM of Alfresco, and in order to simplify the process, I'm using the EmbeddedServer driven by the JUnit testing framework.  I've made some great progress with this, and have been able to search through the repository, find nodes, etc.

My problem is that when I try to create a node that has a custom type that I've defined, I get an error that says "Class {xx}xx has not been defined in the data dictionary.  Of course it is, and I can confirm it by firing up Alfresco in the tomcat environment and creating nodes that are that type, but when I use the embedded server, this type isn't found.

I've tried moving my custom model definition file out of the ./shared/… tree and directly into the alfresco tree.  I've tried adding it to the bootstrap services, I've tried lots of things, but no matter what, it's not found.

Any advice would be appreciated.
Paul
3 REPLIES 3

imzak82
Champ in-the-making
Champ in-the-making
How did you solve this issue.

I am facing a similar problem. 
I can create documents and folder using the my custom model using "http://localhost:8080/alfresco"

But I get Class {http://www.abcxyz123.com/model/abc/1.0}folder has not been defined in the data dictionary
when i try to create the same using java api

ChildAssociationRef association = nodeService.createNode(parentNode,
              ContentModel.ASSOC_CONTAINS,
                     QName.createQName("abc", foldername),   // abc is my prefix
                       QName.createQName("http://www.abcxyz123.com/model/abc/1.0','folder"),
                       contentProps);

kirit
Champ on-the-rise
Champ on-the-rise
Hello imazak,

In your code Why QName creation is happening two times?
Have you tried below code?

ChildAssociationRef association = nodeService.createNode(parentNodeRef,
           ContentModel.ASSOC_CONTAINS,
           QName.createQName(CONTENT_MODEL_PREFIX, nameOfFolder),
            ContentModel.TYPE_FOLDER,
            contentProps);

In case of files you can user ContentModel. TYPE_CONTENT

Let us know if this works for you.

imzak82
Champ in-the-making
Champ in-the-making
Thanks. This problem is resolved. The content model config file was not on the class path in java application.