cancel
Showing results for 
Search instead for 
Did you mean: 

Type not supported error with custom content

monitloth
Champ on-the-rise
Champ on-the-rise
I would like to create a folder, which is a custom folder type (memo:myproject). I get the following error:

org.alfresco.error.AlfrescoRuntimeException: The type is not supported by this service: {http://www.memo.com/model/content/1.0}myproject
   at org.alfresco.repo.model.filefolder.FileFolderServiceImpl.create(FileFolderServiceImpl.java:768)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
   at org.alfresco.repo.model.filefolder.TempFileMarkerInterceptor.invoke(TempFileMarkerInterceptor.java:83)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
   at org.alfresco.repo.model.ml.MLContentInterceptor.invoke(MLContentInterceptor.java:131)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
   at org.alfresco.repo.model.filefolder.MLTranslationInterceptor.invoke(MLTranslationInterceptor.java:210)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy42.create(Unknown Source)
   at be.mygroup.alfresco.extention.CreateMyProjectWizard.getSummary(CreateMyIProjectWizard.java:368)
My memo-model-context.xml file is correct.
memoModel.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="memo:mymodels" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>MyModels</description>
   <author>Mustafa</author>
   <version>1.0</version>

   <!– Imports are required to allow references to definitions in other models –>
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="http://www.memo.com/model/content/1.0" prefix="memo" />
   </namespaces>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="memo:myproject">
         <title>My Project Space</title>
         <parent>cm:folder</parent>
         <properties>
            <property name="memo:begindate">
               <type>d:date</type>
            </property>
            <property name="memo:enddate">
               <type>d:date</type>
            </property>
            <property name="memo:finished">
               <type>d:boolean</type>
               <default>false</default>
            </property>
         </properties>

      </type>
   </types>
</model>
I did not test if this model is read by Alfresco, because now I want to create it to test it.
It is a folder derived type. If there is some other way (like node browser), please tell.

In my code

FileInfo fileInfo = this.getFileFolderService().create(
            this.navigator.getCurrentNode().getNodeRef(), projName,
            QName.createQName(MyProjectModel.NAMESPACE_MEMO_CONTENT_MODEL, "myproject"));
And I get the following by JSF:

The type is not supported by this service: {http://www.memo.com/model/content/1.0}myproject
It should a simple error.

Thanks.
8 REPLIES 8

derek
Star Contributor
Star Contributor
Hi,
What version are you using.  The FileFolderService does a check on the hierarchy
        if (dictionaryService.isSubClass(typeQName, ContentModel.TYPE_FOLDER))
        {
            if (dictionaryService.isSubClass(typeQName, ContentModel.TYPE_SYSTEM_FOLDER))
            {
                return FileFolderServiceType.SYSTEM_FOLDER;
            }
            return FileFolderServiceType.FOLDER;
        }

monitloth
Champ on-the-rise
Champ on-the-rise
Version 3b CE. Hmm

derek
Star Contributor
Star Contributor
Hi,
I've just written a unit test to double-check this and I can confirm that the subtype check works.  My conclusion is that the type has not been registered with the dictionary.  Do you have a custom-model-context.xml (copied from our custom-model-context.xml.sample) in your extensions folder; have you fixed it up to point to your custom model?
Regards

monitloth
Champ on-the-rise
Champ on-the-rise
Here it is (memo-model-context.xml):
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    <!– Registration of new models –>
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/memoModel.xml</value>
            </list>
        </property>
    </bean>
</beans>
When I change the location of the memoModel.xml in memo-model-context.xml. I get the same. So, I have no XML parsing error. It can be that it is not registered, in the console at startup I get no notification of this.
I think the problem can be in memoModel.xml. Because I based on "scModel.xml" from http://ecmarchitect.com/, which worked.

Thanks

derek
Star Contributor
Star Contributor
Hi,
Your model looks right.  Switch on debugging in WEB-INF/classes/log4j.properties:
log4j.logger.org.alfresco.repo.dictionary.DictionaryDAOImpl=DEBUG
Regards

monitloth
Champ on-the-rise
Champ on-the-rise
No notification. I will look at the the working example to figure out why it doesn't work. It should be some code forgotten, misplaced in XML. Thanks.

derek
Star Contributor
Star Contributor
The first thing to do is to put some rubbish (invalid XML) into your custom XML context file.  If that breaks things, then you'll know that the bean is being loaded.  Also, ensure that you don't have multiple custom model loaders.  You should list the models to load in the single location.

monitloth
Champ on-the-rise
Champ on-the-rise
Ok, I got it.

I had 2 "-context.xml" files. The first was read. By including the two in the same file, I got errors and now it works.

A few notes:
I also used a jar files where configuration files where added, so I had two of the same models and other sort of configurations. If I understand it good, the jar files have priority. So make attention for this, if you have an error.

The "web-client-config-custom.xml" must be placed in the extension folder, as default configured in "web-client-application-context.xml".

Great, thanksSmiley Wink