cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Content Model Causes

rdifrango
Champ in-the-making
Champ in-the-making
I created a custom content model and it is displaying properly in the UI.  When I go to run the following sample webscript

http://localhost:18080/alfresco/service/sample/folder

I get the following exception:

500 Description:    An error inside the HTTP server which prevented it from fulfilling the request. Message:   Wrapped Exception (with status template): Error during processing of the template 'get(name) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.    Exception:   freemarker.template.TemplateModelException - get(name) failed on instance of org.alfresco.repo.template.TemplateNode       freemarker.ext.beans.BeanModel.get(BeanModel.java:223)    Exception:   org.alfresco.service.cmr.repository.TemplateException - Error during processing of the template 'get(name) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.       org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:205)    Exception:   org.alfresco.web.scripts.WebScriptException - Wrapped Exception (with status template): Error during processing of the template 'get(name) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.       org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:594)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Here is my custom content model:

<?xml version="1.0" encoding="UTF-8"?>   <!– Definition of new Model –><model name="demo:demomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">   <!– Optional meta-data about the model –>   <description>Demo Model</description>   <author>CapTech Ventures</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" />      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />   </imports>   <!– Introduction of new namespaces defined by this model –>   <namespaces>      <namespace uri="http://www.demo.org/model/content/1.0"         prefix="demo" />   </namespaces>   <constraints>      <constraint name="demo:departmentList" type="LIST">         <parameter name="allowedValues">            <list>               <value>Accounts Payable</value>               <value>HQ &amp; Mailroom</value>               <value>IT &amp; Help Desk</value>                </list>            </parameter>        </constraint>   </constraints>   <types>      <!– Enterprise-wide generic document type –>      <type name="demo:doc">         <title>Demo Document</title>         <parent>cm:content</parent>         <mandatory-aspects>           <aspect>demo:department</aspect>         </mandatory-aspects>      </type>   </types>   <aspects>      <aspect name="demo:department">         <title>Demo Department</title>         <properties>            <property name="demo:departmentName">               <type>d:text</type>               <multiple>true</multiple>               <constraints>                  <constraint ref="demo:departmentList" />               </constraints>            </property>         </properties>      </aspect>   </aspects></model>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
4 REPLIES 4

mrogers
Star Contributor
Star Contributor
There may be some useful information in the Alfresco Logs

rdifrango
Champ in-the-making
Champ in-the-making
This is all the logs have and what it looks like is that the nodes that are my custom content type are note a standard noderef object.  I would not have expected this.

12:05:16,858 User:admin ERROR [freemarker.runtime] get(name) failed on instance of org.alfresco.repo.template.TemplateNodeThe problematic instruction:———-==> ${child.name?url} [on line 19, column 158 in org/alfresco/sample/folder.get.html.ftl]———-Java backtrace for programmers:———-freemarker.template.TemplateModelException: get(name) failed on instance of org.alfresco.repo.template.TemplateNode   at freemarker.ext.beans.BeanModel.get(BeanModel.java:223)   at freemarker.core.Dot._getAsTemplateModel(Dot.java:76)   at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)   at freemarker.core.Expression.getStringValue(Expression.java:93)   at freemarker.core.StringBuiltins$StringBuiltIn._getAsTemplateModel(StringBuiltins.java:71)   at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)   at freemarker.core.Expression.getStringValue(Expression.java:93)   at freemarker.core.DollarVariable.accept(DollarVariable.java:76)   at freemarker.core.Environment.visit(Environment.java:208)   at freemarker.core.MixedContent.accept(MixedContent.java:92)   at freemarker.core.Environment.visit(Environment.java:208)   at freemarker.core.IfBlock.accept(IfBlock.java:82)   at freemarker.core.Environment.visit(Environment.java:208)   at freemarker.core.MixedContent.accept(MixedContent.java:92)   at freemarker.core.Environment.visit(Environment.java:208)   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)   at freemarker.core.Environment.visit(Environment.java:415)   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)   at freemarker.core.Environment.visit(Environment.java:208)   at freemarker.core.MixedContent.accept(MixedContent.java:92)   at freemarker.core.Environment.visit(Environment.java:208)   at freemarker.core.Environment.process(Environment.java:188)   at freemarker.template.Template.process(Template.java:237)   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:201)   at org.alfresco.web.scripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:504)   at org.alfresco.web.scripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:241)   at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)   at org.alfresco.repo.web.scripts.RepositoryContainer$1.execute(RepositoryContainer.java:311)   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:320)   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:227)   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:360)   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:382)   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:264)   at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:260)   at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)   at org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)   at org.alfresco.web.app.servlet.MTWebScriptAuthenticationFilter.doFilter(MTWebScriptAuthenticationFilter.java:102)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)   at java.lang.Thread.run(Thread.java:613)Caused by: java.lang.reflect.InvocationTargetException   at sun.reflect.GeneratedMethodAccessor582.invoke(Unknown Source)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)   at java.lang.reflect.Method.invoke(Method.java:585)   at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:835)   at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:276)   at freemarker.ext.beans.BeanModel.get(BeanModel.java:183)   … 51 moreCaused by: java.lang.UnsupportedOperationException   at java.util.AbstractList.set(AbstractList.java:127)   at org.alfresco.repo.template.PropertyConverter.convertProperty(PropertyConverter.java:62)   at org.alfresco.repo.template.TemplateNode$TemplatePropertyConverter.convertProperty(TemplateNode.java:533)   at org.alfresco.repo.template.TemplateNode.getProperties(TemplateNode.java:221)   at org.alfresco.repo.template.TemplateNode.getName(TemplateNode.java:186)   … 57 more‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

rdifrango
Champ in-the-making
Champ in-the-making
I also can get similar behavior by clicking on the Information on the node in the Alfresco web client.  The exception that it reports is as follows:

13:41:23,767 User:admin ERROR [alfresco.ajax] Failed to execute method NodeInfoBean.sendNodeInfo: Exception in Transaction.org.alfresco.error.AlfrescoRuntimeException: Exception in Transaction.   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:404)   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:227)   at org.alfresco.web.app.servlet.ajax.InvokeCommand.execute(InvokeCommand.java:167)   at org.alfresco.web.app.servlet.ajax.AjaxServlet.service(AjaxServlet.java:148)   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)   at java.lang.Thread.run(Thread.java:613)Caused by: java.lang.reflect.InvocationTargetException   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.alfresco.web.app.servlet.ajax.InvokeCommand$1.execute(InvokeCommand.java:163)   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:320)   … 16 moreCaused by: org.alfresco.service.cmr.repository.TemplateException: Error during processing of the template 'get(mimetype) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:205)   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:181)   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:111)   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.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)   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:275)   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 $Proxy164.processTemplate(Unknown Source)   at org.alfresco.web.bean.ajax.NodeInfoBean.sendNodeInfo(NodeInfoBean.java:96)   … 22 moreCaused by: freemarker.template.TemplateModelException: get(mimetype) failed on instance of org.alfresco.repo.template.TemplateNode   at freemarker.ext.beans.BeanModel.get(BeanModel.java:223)   at freemarker.core.Dot._getAsTemplateModel(Dot.java:76)   at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)   at freemarker.core.ComparisonExpression.isTrue(ComparisonExpression.java:111)   at freemarker.core.OrExpression.isTrue(OrExpression.java:68)   at freemarker.core.OrExpression.isTrue(OrExpression.java:68)   at freemarker.core.ParentheticalExpression.isTrue(ParentheticalExpression.java:66)   at freemarker.core.AndExpression.isTrue(AndExpression.java:68)   at freemarker.core.BooleanExpression._getAsTemplateModel(BooleanExpression.java:61)   at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)   at freemarker.core.Assignment.accept(Assignment.java:90)   at freemarker.core.Environment.visit(Environment.java:208)   at freemarker.core.MixedContent.accept(MixedContent.java:92)   at freemarker.core.Environment.visit(Environment.java:208)   at freemarker.core.Environment.process(Environment.java:188)   at freemarker.template.Template.process(Template.java:237)   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:201)   … 43 moreCaused by: java.lang.reflect.InvocationTargetException   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 freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:835)   at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:276)   at freemarker.ext.beans.BeanModel.get(BeanModel.java:183)   … 59 moreCaused by: java.lang.UnsupportedOperationException   at java.util.AbstractList.set(AbstractList.java:127)   at org.alfresco.repo.template.PropertyConverter.convertProperty(PropertyConverter.java:62)   at org.alfresco.repo.template.TemplateNode$TemplatePropertyConverter.convertProperty(TemplateNode.java:533)   at org.alfresco.repo.template.TemplateNode.getProperties(TemplateNode.java:221)   at org.alfresco.repo.template.BaseContentNode.getMimetype(BaseContentNode.java:440)   … 66 more‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

rdifrango
Champ in-the-making
Champ in-the-making
I finally figured it out, I wanted to allow for an aspect that had multiple values so I did the following:

            <property name="hhmi:departmentName">               <type>d:text</type>               [color=#FF0000][b]<multiple>true</multiple>[/b][/color]               <constraints>                  <constraint ref="hhmi:departmentList" />               </constraints>            </property>‍‍‍‍‍‍‍‍‍

Well, we decided that we no longer needed multiple values, I just changed the highlighted line to false and it worked.