cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing Error with custom Model

dallinns
Champ on-the-rise
Champ on-the-rise
I am following the tutorial at the following URL: http://ecmarchitect.com/images/articles/alfresco-content/content-article.pdf

I have included the files as it displays them at that site, but when I try to reload tomcat with the custom content type it gives me a 404 error and the log file tells me there is an error parsing my model file. I have looked over the file and don't notice any typos. Is there something I'm doing wrong or some difference in the way it is done in the version I'm using and the version in the tutorial?

Here is the model file:
<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Someco Model</description>
   <author>Optaros</author>
   <version>1.0</version>
   
   <!– Imports are required to allow references to definitions in other models –>
   
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
      <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>
   
   <namespaces>
      <namespace uri="http://www.someco.com/model/content/1.0" prefix="sc" />
   </namespaces>
   
   <types>
      <type name="sc:doc">
         <title>Someco Document</title>
         <parent>cm:content</parent>
         <associations>
            <association name="sc:relatedDocuments">
               <title>Related Documents</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>sc:doc</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
         <mandatory­aspects>
            <aspect>cm:generalclassifiable</aspect>
         </mandatory­aspects>
      </type>
      
      <type name="sc:whitepaper">
         <title>Someco Whitepaper</title>
         <parent>sc:doc</parent>
      </type>
   </types>
   
   <aspects>
      <aspect name="sc:webable">
         <title>Someco Webable</title>
         <properties>
            <property name="sc:published">
               <type>d:date</type>
            </property>
            <property name="sc:isActive">
               <type>d:boolean</type>
               <default>false</default>
            </property>
         </properties>
      </aspect>
      
      <aspect name="sc:productRelated">
         <title>Someco Product Metadata</title>
         <properties>
            <property name="sc:product">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="sc:version">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
         </properties>
      </aspect>
   </aspects>
</model>

and the Tomcat log file says this:
Feb 23, 2011 12:01:08 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension\someco-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 01230001 Could not import bootstrap model alfresco/extension/scModel.xml
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:519)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
   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.catalina.startup.Bootstrap.start(Bootstrap.java:289)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 01230001 Could not import bootstrap model alfresco/extension/scModel.xml
   at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:158)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:105)
   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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1529)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1468)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
   … 37 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 01230000 Failed to parse model
   at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:93)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:147)
   … 45 more
Caused by: org.jibx.runtime.JiBXException: Error parsing document (line 27, col 21)
   at org.jibx.runtime.impl.XMLPullReaderFactory$XMLPullReader.next(XMLPullReaderFactory.java:285)
   at org.jibx.runtime.impl.UnmarshallingContext.isEnd(UnmarshallingContext.java:861)
   at org.alfresco.repo.dictionary.JiBX_MungeAdapter.JiBX_root_projects_data_model_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_1_11()
   at org.alfresco.repo.dictionary.M2Class.JiBX_root_projects_data_model_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_1_1(M2Class.java)
   at org.alfresco.repo.dictionary.M2Type.JiBX_root_projects_data_model_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_2_0(M2Type.java)
   at org.alfresco.repo.dictionary.JiBX_root_projects_data_model_source_java_org_alfresco_repo_dictionary_m2bindingM2Type_access.unmarshal()
   at org.alfresco.repo.dictionary.JiBX_MungeAdapter.JiBX_root_projects_data_model_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_1_4()
   at org.alfresco.repo.dictionary.M2Model.JiBX_root_projects_data_model_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_1_0(M2Model.java)
   at org.alfresco.repo.dictionary.JiBX_root_projects_data_model_source_java_org_alfresco_repo_dictionary_m2bindingM2Model_access.unmarshal()
   at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2773)
   at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2916)
   at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:88)
   … 46 more
Feb 23, 2011 12:01:08 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Feb 23, 2011 12:01:08 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/alfresco] startup failed due to previous errors
Feb 23, 2011 12:01:08 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Feb 23, 2011 12:01:08 PM org.apache.catalina.core.ApplicationContext log
INFO: Shutting down log4j
Feb 23, 2011 12:01:08 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: A web application registered the JBDC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Feb 23, 2011 12:01:08 PM org.apache.catalina.loader.WebappClassLoader clearReferencesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [MySQL Statement Cancellation Timer] via the java.util.Timer API but has failed to stop it. To prevent a memory leak, the timer (and hence the associated thread) has been forcibly cancelled.
Feb 23, 2011 12:01:08 PM org.apache.catalina.loader.WebappClassLoader clearReferencesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [net.sf.ehcache.CacheManager@ac20151] via the java.util.Timer API but has failed to stop it. To prevent a memory leak, the timer (and hence the associated thread) has been forcibly cancelled.
Feb 23, 2011 12:01:08 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@4508dacb]) and a value of type [org.alfresco.util.CachingDateFormat] (value [yyyy-MM-dd]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
Feb 23, 2011 12:01:08 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [null] (value [com.sun.xml.bind.v2.runtime.Coordinator$1@485468d5]) and a value of type [com.sun.xml.bind.v2.runtime.Coordinator[]] (value [[Lcom.sun.xml.bind.v2.runtime.Coordinator;@1dae9d0c]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
Feb 23, 2011 12:01:08 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@32c88e0d]) and a value of type [org.apache.cxf.bus.CXFBusImpl] (value [org.apache.cxf.bus.CXFBusImpl@ce61187]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.

I can't figure out why there would be a parser error on line 27, col 21. Any help is appreciated.
3 REPLIES 3

jobispo
Champ in-the-making
Champ in-the-making
The error is in line 27, because you were notified by: Caused by: org.jibx.runtime.JiBXException: Error parsing document (line 27, col 21). So the error should be around to:
           <association name="sc:relatedDocuments">

I cannot see any defect closed to this line.

If you copied this code directly from a PDF book, take care with hidden characters. Probably you've got one.

Regards.

jobispo
Champ in-the-making
Champ in-the-making
Sorry, i didn't see.

That's uncorrect: <mandatoryaspects> the correct sintax is <mandatory-aspects>

But it's not in the line 27, so probably you've got two errors.

Regards.

dallinns
Champ on-the-rise
Champ on-the-rise
Special characters were the problem. Thanks.