cancel
Showing results for 
Search instead for 
Did you mean: 

New content model definitions

andrepra
Champ in-the-making
Champ in-the-making
Following the procedure explained in the wiki for the creation of new content model xml I've configured the spring extension file terminating with -context.xml in the extensions directory. If I define two content models in two different files and I use two diffrent -context.xml files to load these extensions I'm getting an error on "add content function". Here the exception.

javax.faces.FacesException: Cannot get value for expression '#{AddContentWizard.objectTypes}'

caused by:
org.apache.jasper.JasperException: Cannot get value for expression '#{AddContentWizard.objectTypes}'

caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{AddContentWizard.objectTypes}'

caused by:
javax.faces.el.EvaluationException:
org.alfresco.web.bean.wizard.AddContentWizard

caused by:
javax.faces.el.EvaluationException: Bean:
org.alfresco.web.bean.wizard.AddContentWizard, property: objectTypes

caused by:
java.lang.reflect.InvocationTargetException

caused by:
java.lang.NullPointerException

Using only one -context.xml file everything seems works fine. I have to use a single -context.xml file for all the content model definitions or I forgot something?
3 REPLIES 3

davidc
Star Contributor
Star Contributor
No, you don't have to use a single -context.xml file to register models.  Alfresco's own models are registered this way.

Having just scanned the function throwing the NPE, the cause is not obvious without some more context.   Can you provide:

- the model definitions
- the context definitions which register the models
- the web client content-types definition
- the line number where the NPE is reported (should be in the exeption trace from the error page or the server console)

Thanks.

oburlaca
Champ in-the-making
Champ in-the-making
I can confirm that there is a problem when having multiple *-context.xml files.

Scenario: I'm using custom-model-context.xml for adding a custom aspect. Everything works well. After that I've created new xyz-context.xml and xyzModel.xml files, made the required changes to web-client-config-custom.xml. Restarted Alfresco and I can't see the new content types when accessing "Create Content Wizard". But when I try to create a custom rule and choose "Items of a specified type or sub-type", I get the following error:

in browser:

javax.faces.FacesException: Cannot get value for expression '#{WizardManager.bean.modelTypes}'
caused by:
org.apache.jasper.JasperException: Cannot get value for expression '#{WizardManager.bean.modelTypes}'
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{WizardManager.bean.modelTypes}'
caused by:
javax.faces.el.EvaluationException: Exception getting value of property modelTypes of base of type : org.alfresco.web.bean.rules.CreateRuleWizard
caused by:
javax.faces.el.EvaluationException: Bean: org.alfresco.web.bean.rules.CreateRuleWizard, property: modelTypes
caused by:
java.lang.reflect.InvocationTargetException
caused by:
java.lang.NullPointerException

in log file:

ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
        at org.alfresco.repo.dictionary.DictionaryDAOImpl.getType(DictionaryDAOImpl.java:503)
        at org.alfresco.repo.dictionary.DictionaryComponent.getType(DictionaryComponent.java:254)
        at org.alfresco.web.bean.rules.CreateRuleWizard.getModelTypes(CreateRuleWizard.java:310)
        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:597)
        at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:457)
        at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
        at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:535)
        at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
        at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
        at javax.faces.component.UISelectItems.getValue(UISelectItems.java:58)
        at org.apache.myfaces.shared_impl.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:105)
        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:450)
        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:428)
        at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:294)
        at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:267)
        at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:59)
        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
        at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:498)
        at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:366)
        at org.apache.jsp.jsp.rules.is_002dsubtype_jsp._jspx_meth_h_005fselectOneMenu_005f0(is_002dsubtype_jsp.java:1154)
        at org.apache.jsp.jsp.rules.is_002dsubtype_jsp._jspService(is_002dsubtype_jsp.java:494)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
        at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
        at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        at java.lang.Thread.run(Thread.java:619)

if I stop Alfresco, rename/remove the custom-model-context.xml to custom-model-context.xml.sample and start Alfresco, I'm able to see the new content types defined in xyz-context.xml. I've created new items using xyz types and it worked.

luiseterc
Champ in-the-making
Champ in-the-making
Forgot to say I'm using:

Alfresco JVM - v1.5.0_15-b04; maximum heap size 1444.500MB
Alfresco started (Labs): Current version 3.0.0 (a 1032) schema 128 - Installed version 3.0.0 (a 1032) schema 128

Cheers